I’m having trouble figuring out why the following transform works as I expected it to in Saxon invoked by JAXP, and from the Saxon.net command line, but produces different results when invoked from an Asp.net application:

 

Here’s the xslt in question – the url is http://www2.turffiles.ncsu.edu/ContentManagement/CMXml/TestTransform.xsl

 

   <xsl:template match="PropertyGroupSet">

               

                <xsl:variable name="fieldNames">                                             

                                <xsl:value-of select="Property/Name" separator=","></xsl:value-of>                                            

                </xsl:variable>

                               

                <xsl:value-of select="$fieldNames"></xsl:value-of>

                <xsl:choose>

                        <xsl:when test="Property/IsSingleValueProperty=0">    

                                <br></br>

                                <fieldset>

                                        <xsl:call-template name="multipleValues"/>

                                        <legend>                                             

                                                <xsl:value-of select="@Name" />

                                                <img class="groupOptions" src="http://www.turffiles.ncsu.edu/images/fwd.gif" onclick="ShowPossibilities(event,{@PropertyID},true,'{$fieldNames}')" />                                             

                                        </legend>

                                        <xsl:call-template name="formItem"/>

                                </fieldset>                                     

                        </xsl:when>

                        <xsl:otherwise>

                                <xsl:call-template name="formItem"/>

                                <img class="Options" src="http://www.turffiles.ncsu.edu/images/fwd.gif" onclick="ShowPossibilities(event,{Property/PropertyID},false,'{$fieldNames}')" />     

                        </xsl:otherwise>

                </xsl:choose>             

        </xsl:template>

 

The source document is at http://www2.turffiles.ncsu.edu/ContentManagement/CMXml/TestProps.xml

 

The relevant section is the following PropertyGroupSet node with 2 name descendants:

 

<PropertyGroupSet Name="Author" PropertyID="17">

    <Property>

      <PropertyID>5</PropertyID>

      <Name>LastName</Name>

      <FriendlyName>Last Name</FriendlyName>

      <Type>String</Type>

      <IsUnique>false</IsUnique>

      <IsSingleValueProperty>0</IsSingleValueProperty>

      <PropertyGroupSet>Author</PropertyGroupSet>

    </Property>

    <Property>

      <PropertyID>6</PropertyID>

      <Name>FirstName</Name>

      <FriendlyName>First Name</FriendlyName>

      <Type>String</Type>

      <IsUnique>false</IsUnique>

      <IsSingleValueProperty>0</IsSingleValueProperty>

      <PropertyGroupSet>Author</PropertyGroupSet>

    </Property>

  </PropertyGroupSet>

 

I expect that the $fieldNames variable will select both Name nodes in this group; instead, it only selects the first of these.  More oddly still, the xpath expression count(Property/Name) correctly returns the value 2 here.  Property/Name[2] returns ‘FirstName’, as I expect it to.  Is there an error in my xslt that I’m not seeing?  Or is this an issue in Saxon.Net?  As I said, this works fine from the command line for both Saxon and Saxon.net, and invoked by jaxp in java.

 

On a somewhat related issue: I also had trouble with a couple of other xpath functions: node-name() and distinct-values() both seemed to choke the saxon.net processor, at least when I tried them.

 

Thanks,

Joe Levine