OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Dynamically creating a pattern for xsl:apply-templates select

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Dynamically creating a pattern for xsl:apply-templates select
  • From: Mark Heieis <mark.heieis@shaw.ca>
  • Date: Thu, 29 Jul 2004 15:51:07 -0700
  • User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

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 

is made to look something like

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

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

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.


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS