Re: [xsl] Question about cross references

Subject: Re: [xsl] Question about cross references
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Wed, 26 Apr 2006 14:04:44 -0500
That's very possible (and a common task for those of us, including me, who
use XSLT to mangle documents).

To handle it, you need to write a template to handle xref nodes. Something
like this:

<xsl:template match="xref">
  <fo:basic-link internal-destination="{@xrefid}"><xsl:value-of
select="."/></fo:basic-link>
</xsl:template>

You also need to create matching ids (the actual destinations) within the
FO, so you need to do that wherever you have an id attribute in the source.
Something like this:

<xsl:template match="list1">
  <fo:block>
    <xsl:if test="@id">
      <xsl:copy-of select="@id"/>
    </xsl:if>
    <xsl:value-of select="."/>
  </fo:block>
</xsl:template>

Of course, you'll probably want to use the proper list elements for your
list. I just stuck it in a block for simplicity's sake.

Just remember that you need both a link and a corresponding id for the link.

Also, if you can have id attributes in other than list1 nodes (seems
likely), you'll want to either handle it in each template or write a
separate template just to handle id attributes.

If you have more trouble, post back to the list.

HTH

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Tech Savvy" <tecsavvy@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 26, 2006 1:39 PM
Subject: [xsl] Question about cross references


Hello:

I am trying to achieve a corss ref in xslt and xsl:fo.

Here is wht the XML looks like:
<

list1 id="l1">
<text>

<para>Some text</para>

</text>

</list1>

<list1 id="l2">


<text>

<para>Some other text as in list <xref xrefid ="l1"/>A.</para>

</text>

</list1>

The desired result is:

1. Some text
2. Some other text as in list 1A.

But the current result is:
1. Some text
2. Some other text as in list l1A.


I want to get the reference from the xrefid and put it on the text.
The lists are formatted on the XSLT as eithr numbers(1,2) or (A,B)
etc.

Is there nay way this can be achieved thru XSLT.

Thanks in advance for your help.

Current Thread