Subject: Re: [xsl] Question about cross references From: "Tech Savvy" <tecsavvy@xxxxxxxxx> Date: Thu, 27 Apr 2006 12:14:09 -0500 |
Hi: Sorry about that, I must have done a reply instead of a reply-all. I am currently trying to achieve this on XSLT. This is what I did: I declared a key for the ids... <xsl:key name="steps" match="*[@id]" use="@id"/> And on the xref template: <xsl:template match="xref"> <a href="@xrefid"> <xsl:for-each select="key('steps',@xrefid)"> <xsl:number count="list1" level="any" format="1"/> </xsl:for-each> </a> </xsl:template> Any suggestions on this approach? On 4/27/06, Jay Bryant <jay@xxxxxxxxxxxx> wrote: > First, an admin thing: all traffic should go to the list. Down the road, > someone will have the same question, and they might find the answer in the > archives if we keep all the traffic on the list. Writing to someone directly > probably doesn't get a faster or better response, and it robs the archive of > potentially useful information. I've cc'd the list to get us back on track. > > From your earlier post, I suspect that the following template is the source > of your problem: > > <xsl:template match="xref"> > > <xsl:apply-templates select="@xrefid"/> > > </xsl:template> > > > Do you have a template to handle that attribute or are you letting your XSLT > processor take its default behavior (which is to put the text value of the > attribute into the output)? If you are letting it take its default behavior, > you'll never get the FO tags you need. > > Also, it's easier (and more maintainable) to just do it all here in this > template rather than call another one from this point. > > To say more, I'd have to see more of your transform. > > Jay Bryant > Bryant Communication Services > > ----- Original Message ----- > From: "Tech Savvy" <tecsavvy@xxxxxxxxx> > To: <jay@xxxxxxxxxxxx> > Sent: Thursday, April 27, 2006 10:35 AM > Subject: Re: [xsl] Question about cross references > > > Hello: > > I have still not been able to find a solution to this problem. Would > you have any other suggestions to this. > > Thank you > > > > > 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: [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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Question about cross refe, Jay Bryant | Thread | [xsl] Unwanted xmlns attribute appe, Karine Delvare |
Re: [xsl] Question about cross refe, Jay Bryant | Date | Re: [xsl] sum up float values probl, Florent Georges |
Month |