XSL works only in debug
Added by Anonymous over 13 years ago
Legacy ID: #10046277 Legacy Poster: GaryL (garylarsen)
I'm using Saxon 8 and have run into a situation where about 1 in 80 identically structured docs have incorrect xml to xml transformations. I also tried this with 9.2 in XMLSpy and had the same error, though the built-in transformer worked correctly. I am transforming this fragment Public Folders NetVisn Demo NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder using this template: <xsl:template match="/nv:content/nv:lookupInfo/nv:groupByLevel/nv:String"> <xsl:variable name="pos" select="position()"/> <xsl:if test="$pos lt 6"> <xsl:element name="{concat('l', $pos)}" namespace="http://developer.envisn.com/xmlns/envisn/netvisn/"> <xsl:value-of select="."/></xsl:element> </xsl:if> </xsl:template> which should generate this: Public Folders NetVisn Demo NetVisn Demo / Test Folder NetVisn Demo / Test Folder NetVisn Demo / Test Folder but instead generates this: Public Folders NetVisn Demo (The result included the whitespace) I can't seen anything different between the successful docs and the ones with problems, but the error is repeatable. If someone can take a look I can email the files. Thanks! gary
Replies (1)
RE: XSL works only in debug - Added by Anonymous over 13 years ago
Legacy ID: #10046475 Legacy Poster: GaryL (garylarsen)
I found the problem - sorry for the noise. It appears the problem documents must have had whitespace throwing off position(). <xsl:strip-space elements="nv:String nv:groupByLevel"/> gary
Please register to reply