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

Re: problem with handling conditional for loops

Subject: Re: problem with handling conditional for loops
From: Rahil <qamar_rahil@xxxxxxxxxxx>
Date: Wed, 27 Apr 2005 18:06:06 +0100
hello 1234
Aron Bock wrote:


<xsl:choose>
<xsl:when test="document(Second.xml)/SubConcepts/SubConcept[1]/Value[$clsName=text()]">


<xsl:variable name="nodeToProcess"
select="document(Second.xml)/SubConcepts/SubConcept[1]/Value[$clsName=text()]"/>


</xsl:when>

<xsl:otherwise>
<xsl:variable name="Values"
select="document(Second.xml)/SubConcepts/SubConcept/Value/@name[.=$clsName]"/>


<xsl:variable name="nodeToProcess" select="$Values[1]">
</xsl:otherwise>
</xsl:when>
<<<

You probably want:

<xsl:variable name="nodeToProcess">
   <xsl:choose>
   ...
  </xsl:choose>
</xsl:variable>

The choose should be inside the variable definition; else the variable goes out of scope when the choose finishes.


Sorry trouble already. $nodeToProcess now correctly contains values found in either the <xsl:when> or <xsl:otherwise> statement.

However how can I also add the value of the 'id' attribute to $nodeToProcess so that I can look for references to the result based on its id at a later stage ?

E.g. <Value id="1234">Hello</Value>

So I want that $nodeToProcess contains both 'Hello' and '1234' say of the form 'Hello,1234' or 'Hello 1234'.

I tried out a few ways of doing it but none worked!

Suggestions
Rahil

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.