[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: strange issue with execution order of range expre

Subject: Re: 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
Re:  strange issue with execution order of range  expre
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.