[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Question about cross references
Hello Jay: Thank you for your quick response. I have to implement this on both XSLT and XSLT Fo. I added this code to get the ID attribute for all the lists - <xsl:if test="@id"> <xsl:copy-of select="@id"/> </xsl:if> I matched xref using the code: <xsl:template match="xref"> <xsl:apply-templates select="@xrefid"/> </xsl:template> My problem is, how do I make this xrefid get to match the id value on the list and produce the number against it? Like this: > 1. Some text > 2. Some other text as in list 1A. On 4/26/06, Jay Bryant <jay@xxxxxxxxxxxx> wrote: > 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: 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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|