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

RE: Variable iteration

Subject: RE: Variable iteration
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Thu, 19 May 2005 13:06:01 +0000
xsl variable iteration
fadi,

If you don't care about the order of test,

test="@requiredknowledge=preceding::*[name()=concat('chunk_name',$n,'_knowledge')]">

Could be something like:


test="@requiredknowledge=preceding::*[substring(local-name(), 1, 10) = 'chunk_name' and ...]">

If you want to test for a specific order of $n, you could use a loop to pass in various values of n. How you generate that loop of numbers should be an FAQ. Essentially, select arbitrary nodes from XML (or current XSL) doc, and use position().

<xsl:for-each select="/foo/bar[position() &lt;= 3]"> // use a better path
   <xsl:variable name="n" select=" position of . "/>
   ...
</

Regards,

--A

From: fadi qutaishat <fadi_taher2000@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Variable iteration Date: Thu, 19 May 2005 04:05:47 -0700 (PDT)


Hi all,

I am having the following xslt file

...

<xsl:template match="chunk" mode="content">

<xsl:choose>
<xsl:when
test="@requiredknowledge=preceding::*[name()=concat('chunk_name',$n,'_knowledge')]">


<xsl:copy-of select="section"/>


</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
...

In case of any matches this files extracts the
chunks sections that meets the condition. My problem
that I might have something like
chunk_name1_knowledge,  chunk_name2_knowledge,
chunk_name5_knowledge, chunk_name9_knoweldge, etc.
which are not sequentially ordered.

How can I assign these different values (i.e numbers)
to the variable $n.

I know that things can be structured in a different
way, but to some extent I think I would need them like
that way.

_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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.