Subject: Re: [xsl] Self index? From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 11 Apr 2003 13:38:31 +0100 |
And I didn't have a template match on h3 (yet another duh!). I was trying to process it from the stylesheet end? Of course we're still working with zero information on what your stylesheet looks like but yes I suppose that you were generating your headers with literal result elements in the stylesheet and the toc by re-processing the stylesheet as a source with document('') these two instances of the stylesheet are treated as different documents by saxon so you won't get the same ids. You don't even get the same input trees necessarily as the white space stripping will be different unless you are very careful to set things up with xsl:strip space. When read as a stylesheet there is no text node as a child of xsl:template in <xsl:template match="x"? <xsl:value-of select="."/> </xsl:template> but if you read the stylesheet with document('') as a source document then by default that element has two text child nodes, one with a newline and two spaces, and one with just a newline. So if you want to use generate-id you have to use document('') on both ends of the link, or since you are using xslt2 and don't need to mess with node-set() you can put all your <h3 elemnts into a variable <xsl:variable name="x"> <h3>lkhlg</h3> lkhlk ... </xsl:variable> then you process apply templates once to $x to output the headers, adding an id with generate-id and apply templates in a different node to make the toc. this is the same as the document('') case except using the variable as a temporary document instead of re-parsing the stylesheet. You can do same in xslt1 if you use a node-set() extension. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Self index?, David . Pawson | Thread | [xsl] XML Processor testing, Jarkko . Moilanen |
RE: [xsl] Using XSLT within VB.net?, Philip Fitzsimons | Date | RE: [xsl] XML Processor testing, Jarkko Moilanen |
Month |