← Prev in month ← Prev in thread

A tricky xref problem

From
Nancy Brandt <>
Date
2009-10-20T12:30:08+00:00
ID
Thread
A tricky xref problem
Hi all,

I wonder if there is a way to extract a text string and pass it as a value for the <xref linkend=""/> expression. For example, when I write:

Some text  text   text  (see ref=[sect_test]), 

I would like to take the text within the [ ] delimiters and pass it as a value for the linkend attribute of the xref element called in my customized table template. The  reason for this special workaround is that I've created a custom template that enables you to add a table row with its entries using one command, like so:
<table>
...

<row entry1="red" entry2="blue" entry3="black"/> -which saves a lot of typing.

So, if I wish to add a reference to some section from within entry1, I can't write:
<row entry1="red (refer to <xref linkend="sect_test"/>)" entry2="blue"
 entry3="black"/>

I need somehow to customize my table template that says something like:
...
<xsl:for-each select="row">
  <row>
    <xsl:if test="$entry1">
      <entry>
      <xsl:value-of select="@entry1"/>
      <xsl:if test="contains('xref')">
        <xref>
          <xsl:copy-of select="@*"/>
            <xsl:attribute name="linkend">
              <xsl:copy-of select="@*"/>
              <xsl:value-of
 select="<extracted_text_string>"/>
            </xsl:attribute>
          </xref>
    </xsl:if>
      </entry>
   </xsl:if>
...
 </row>
</xsl:for-each>
...

Please, advise me how to extract the text string from within [ ] delimiters to pass it as a value for the <xref> expression.

Thanks a lot in advance!!!

Best wishes,
Nancy
← Prev in month ← Prev in thread