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

populate nodelist variable with a variable in select

Subject: populate nodelist variable with a variable in select statement
From: Lara Brian <lara_bc@xxxxxxxxx>
Date: Mon, 1 Dec 2008 15:45:15 -0800 (PST)
 populate nodelist variable with a variable in select
Hi,
I am trying to populate a variable with a nodelist that takes a variable in
its select statement.

For example,
<xsl:variable name="myNodeSet" select="site/assets/asset[(type/@code = 'aaa')
and starts-with(@vpath,'my/path/')  and (lang='us_en') and $SEARCH_STRING]"/>

and SEARCH_STRING is defined as
<xsl:param
name="SEARCH_STRING"> and ( (related/@code = '111') or
(related/@code = '222') or (related/@code = '333') )</xsl:param>

My xml is of the form,
<site>
<assets>
<asset vpath="my/path/and/more">
<lang>eng</lang>
<featured-item>No</featured-item>
<type code="aaa"/>
<related code="111"/>
<related code="777"/>
</asset>
<asset>
  ...
</asset>
</assets>
<site>

Is
this even possible? I can do this using <xsl choose> and checking
each condition and setting the variable accordingly, but in future if i
have more conditions for the variable, i need to add more conditions in
all my xsls. It would be nice if i can set this variable in one place
and then use it use it as a replace string.

Thanks for any help or pointers in this regard.

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.