Subject: Re: [xsl] strange issue with execution order of range expression (for $x in 1 to $y) From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Thu, 17 Dec 2009 13:02:42 +0000 |
removing all of the irrelevant code, that simplifies down to: <xsl:function name="nxp:getPinningTableRow"> <xsl:param name="rowIndex"/> <row rowIndex="{$rowIndex}"/> </xsl:function> <xsl:template match="/"> <tbody> <xsl:copy-of select="for $i in (1 to 5) return nxp:getPinningTableRow($i)"/> </tbody> </xsl:template> which outputs: <tbody> <row rowIndex="1"/> <row rowIndex="2"/> <row rowIndex="3"/> <row rowIndex="4"/> <row rowIndex="5"/> </tbody> using Saxon 9.1.0.3 If you get something different with the above, post back with your set up. cheers andrew 2009/12/17 Robby Pelssers <robby.pelssers@xxxxxxxxx>: > Hi all, > > I have following template which calls a custom function I wrote for a certain range: > > <!-- > | This template handles the Topic 'Pinning information' (-> CharacteristicSet 'Pinning information') > | Note: We need to take the simplified outline graphic from the package instead of the product > --> > <xsl:template match="Topic[@id='pinning_information']" mode="topic"> > <xsl:variable name="pinChar" select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTer m) and Parameter/@DETIdentifier='PAE050']"/> > <xsl:variable name="symbolChar" select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTer m) and Parameter/@DETIdentifier='PAE051']"/> > <xsl:variable name="descriptionChar" select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTer m) and Parameter/@DETIdentifier='PAE061']"/> > <xsl:variable name="simplifiedOutline_FigureCode" select="$pa_cs_graphicreferences/Characteristics/Characteristic[not(MinorTerm) and Parameter/@DETIdentifier='PAF008']/Values/Value"/> > <xsl:variable name="graphicSymbol_FigureCode" select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTer m) and Parameter/@DETIdentifier='PAF002']/Values/Value"/> > <!-- we can count the rowSize based on pin, symbol or description rows, here we count the number of pin rows--> > <xsl:variable name="rowSize" select="count($pinChar/Values/Value)"/> > > <p-topic id="{@id}"> > <title><xsl:value-of select="@title"/></title> > <xsl:call-template name="prolog"/> > <body> > <table tabletype="nonQuantitative"> > <title><xsl:value-of select="if (@tabletitle) then @tabletitle else @title"/></title> > <tgroup cols="5"> > <colspec colnum="1" colname="col1" colwidth="*"/> > <colspec colnum="2" colname="col2" colwidth="*"/> > <colspec colnum="3" colname="col3" colwidth="*"/> > <colspec colnum="4" colname="col4" colwidth="*"/> > <colspec colnum="5" colname="col5" colwidth="*"/> > <thead> > <row> > <entry colname="col1"> > <p>Pin</p> > </entry> > <entry colname="col2"> > <p>Symbol</p> > </entry> > <entry colname="col3"> > <p>Description</p> > </entry> > <entry colname="col4"> > <p>Simplified outline</p> > </entry> > <entry colname="col5"> > <p>Graphic symbol</p> > </entry> > </row> > </thead> > <tbody> > <xsl:copy-of select="for $i in (1 to $rowSize) return (nxp:getPinningTableRow($rowSize, $i, $pinChar, $symbolChar, $descriptionChar, $simplifiedOutline_FigureCode, $graphicSymbol_FigureCode))" copy-namespaces="no"/> > </tbody> > </tgroup> > </table> > </body> > </p-topic> > </xsl:template> > > <xsl:function name="nxp:getPinningTableRow"> > <xsl:param name="rowSize"/> > <xsl:param name="rowIndex"/> > <xsl:param name="pinChar"/> > <xsl:param name="symbolChar"/> > <xsl:param name="descriptionChar"/> > <xsl:param name="simplifiedOutline_FigureCode"/> > <xsl:param name="graphicSymbol_FigureCode"/> > <row rowIndex="{$rowIndex}"/> > </xsl:function> > > The weird thing is that the generated <tbody> looks like > > <tbody> > <row rowIndex="5"/> > <row rowIndex="1"/> > <row rowIndex="2"/> > <row rowIndex="3"/> > <row rowIndex="4"/> > </tbody> > > Is a range not supposed to be executed in order 1 -> 2 -> 3-> 4-> 5 ?? Or what could potentially mess-up the execution order of calling this function? > > Robby Pelssers > http://robbypelssers.blogspot.com/ > > -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] strange issue with execution , Robby Pelssers | Thread | RE: [xsl] strange issue with execut, Robby Pelssers |
[xsl] strange issue with execution , Robby Pelssers | Date | RE: [xsl] space was stripping, Selvaganesh |
Month |