OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: RE: A tricky xref problem

Your example is confusing, because in standard DocBook, <row> does not have "entry" attributes, only <entry> child elements.
But assuming you know that and this is really what you want, it sounds like you are saying that you want to use the concatenated values of the other attributes as the link ID. I think that you would do that not by dynamically adding a "linkend" attribute, but by modifying the "xref" template so that it retrieves the values of those other attributes directly; something like this:
<xsl:variable name="linkID" select="@linkend" />
    <xsl:when test="id( $linkID )">
        <xsl:call-template name="createURI">
            <xsl:with-param name="element" select="id( $linkID )" />
        <xsl:call-template name="createURI">
            <xsl:with-param name="element" select="*[concat(@entry1, @entry2, @entry3) = $linkID]" />
You would have to make the entry text retrieval match the exact pattern you want, but that's generally how I'd approach it.

From: Nancy Brandt [mailto:nancy_brndt@yahoo.com]
Sent: Tuesday, October 20, 2009 5:30 AM
To: docbook-apps@lists.oasis-open.org
Cc: bobs@sagehill.net
Subject: 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:

<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">
    <xsl:if test="$entry1">
      <xsl:value-of select="@entry1"/>
      <xsl:if test="contains('xref')">
          <xsl:copy-of select="@*"/>
            <xsl:attribute name="linkend">
              <xsl:copy-of select="@*"/>
              <xsl:value-of select="<extracted_text_string>"/>

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,

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]