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

building of a variable which contains nodes

Subject: building of a variable which contains nodes
From: Stephane.Le-Deaut@xxxxxxxxxx
Date: Mon, 3 Dec 2001 15:04:25 +0100
xsl nodelist exist

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


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.