Subject: Re: Only child pattern -- XT bug or my failure? From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx> Date: Wed, 07 Jun 2000 16:26:21 -0400 |
Chris Powell wrote: > > Looking at the XSLT recommendation, I see > that the correct match should be DOC/DIV[last()=1]. However, when > documents have multiple divisions (that is, they are correctly marked up > with no superfluous wrapping DIV), the first DIV gets matched and the > template gets applied; siblings get left alone. This isn't probably much help - based on the attached results, I can only really suggest you try Saxon. The template match you suggested is correct, and this may well be a bug in XT - it definitely produced different results from Saxon. Here's my input, XSLT and output. ---- input ---- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE document> <document> <doc> <div>doc1-div1</div> <div>doc1-div2</div> </doc> <doc> <div>doc2-div1</div> </doc> <doc> <div>doc3-div1</div> <div>doc3-div2</div> <div>doc3-div3</div> </doc> </document> --- xslt ---- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="doc/div[last()=1]"> <xsl:value-of select="." /> <xsl:text> (</xsl:text> <xsl:value-of select="position()" /> <xsl:text> - </xsl:text> <xsl:value-of select="last()" /> <xsl:text>) </xsl:text> </xsl:template> <xsl:template match="text()" /> </xsl:stylesheet> ---- output with saxon 5.3.2 ---- <?xml version="1.0" encoding="utf-8" ?> doc2-div1 (2 - 3) ---- output with xt 19991105 ---- <?xml version="1.0" encoding="utf-8"?> doc1-div1 (2 - 5) doc3-div2 (4 - 7) Really wierd! I've asked this before, but can someone explain why position() and last() give the results they do in the Saxon output? -- Warren Hedley XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Only child pattern -- XT bug or, Sebastian Rahtz | Thread | Re: Only child pattern -- XT bug or, Chris Powell |
Re: Only child pattern -- XT bug or, Sebastian Rahtz | Date | Re: Best way to handle multiple str, David Carlisle |
Month |