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

Dynamically creating a pattern for xsl:apply-templates select

  • To: xml-dev@l...
  • Subject: Dynamically creating a pattern for xsl:apply-templates select
  • From: Mark Heieis <mark.heieis@s...>
  • Date: Thu, 29 Jul 2004 15:51:07 -0700
  • User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

xsl apply templates select
I have some challenges to solve:

I need to parse a string that contains n number of args, which is in the 
form of  "arg1, arg2,...argn". The args define either an attribute or 
element value. The goal is to prune a large tree using the given arguments.

I want to dynamically create a pattern for the following using the above 
input string, such that

    <xsl:apply-template select=path/node[@name=$arg1 or @name=$arg2 or 
@name=$argn]/>

is made to look something like

    ...
    <xsl: variable name="pattern">@name=$arg1 or @name=$arg2 or 
@name=$argn</xsl:pattern>
or
    <xsl: variable name="pattern">@name='$arg1 | $arg2 | 
$argn'</xsl:pattern>
   ....

which would then be used as
    ...
    <xsl:template match='somecondition''>
        <xsl:apply-templates select=path/node[$pattern]/>
   </xsl:template>

The questions are:
Can the select attribute accept pattern defined by a variable? So far I 
haven't been able to make it work.
If yes, how should it be constructed based on the given input string?
If no, what would be an approach to filter a tree based on the given input?
Or even if yes, is there a better way to filter a large tree?

Thanks in advance.


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.