xsl-list
[Top] [All Lists]

[xsl] strange issue with execution order of range expression (for $x in 1 to $y)

2009-12-17 07:54:59
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[(_at_)id='pinning_information']" mode="topic">
    <xsl:variable name="pinChar" 
select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTerm) 
and Parameter/@DETIdentifier='PAE050']"/>
    <xsl:variable name="symbolChar" 
select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTerm) 
and Parameter/@DETIdentifier='PAE051']"/> 
    <xsl:variable name="descriptionChar" 
select="$pr_cs_pinninginformation/Characteristics/Characteristic[not(MinorTerm) 
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(MinorTerm) 
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="{(_at_)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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>