This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

building of a variable which contains nodes




Hello,

I would like to create a variable which contains nodes. The node comes from the newReferenceAuthentifiedPackageDescriptorFile file or the currentAuthentifiedPackageDescriptorFile file. If i use <xsl:if> element my code is like this :

<xsl:if test="$buildingType='EXCEPTION_PROCEDURE' ">
    <xsl:variable name="ListOfServiceDescriptor"
          select="$currentAuthentifiedPackageDescriptorFile
         //Subset[normalize-space(@serviceName)!='' and
         .//SingleElement/@isVersionned='YES']"/>

    <xsl:call-template name="makeRootDescriptor">
       <xsl:with-param name="listOfServiceDescriptor"
                       select="$ListOfServiceDescriptor"/>
    </xsl:call-template>
</xsl:if>

<xsl:if test="$buildingType='STANDARD' ">
    <xsl:variable name="ListOfServiceDescriptor"
          select="$newReferenceAuthentifiedPackageDescriptorFile
                               //Subset[contains($servicesDescriptor,@serviceName)]"/>

    <xsl:call-template name="makeRootDescriptor">
       <xsl:with-param name="listOfServiceDescriptor"
                       select="$ListOfServiceDescriptor"/>
    </xsl:call-template>
</xsl:if>

This program works fine, but I don't want  to duplicate the call of the makeRootDescriptor template.
I want to call this template once. So I'm trying to solve my problem by using <xsl:choose> element like this

<xsl:variable name="ListOfServiceDescriptor">
      <xsl:choose>
       <xsl:when test="$buildingType='EXCEPTION_PROCEDURE' ">

         <xsl:value-of select="$newReferenceAuthentifiedPackageDescriptorFile
                               //Subset[contains($servicesDescriptor,@serviceName)]"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="$currentAuthentifiedPackageDescriptorFile//Subset[normalize-space(@serviceName)!='' and
                                                                                                                                      .//SingleElement/@isVersionned='YES']"/>
       </xsl:otherwise>
      </xsl:choose>
</xsl:variable>

    <xsl:call-template name="makeRootDescriptor">
       <xsl:with-param name="listOfServiceDescriptor"
                       select="$ListOfServiceDescriptor"/>
    </xsl:call-template>

But it doesn't work because <xsl:value-of> element returns a string value, so I got this message :
XPATH: Can not convert #RTREEFRAG to a NodeList!


Does there exist another approach ?
Is the <xsl:if> element is the only solution ?

Thanks for your help.
Stéphane



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]