Subject: Re: [xsl] SETS comparison..? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 23 Jan 2002 17:19:47 +0000 |
Hi Martijn, > Is it possible to group values not having to repeat the same > attribute over and over? > > e.g.: <xsl:if test=". in ['a', 'b', 'd']"> In XPath 1.0, you have to do: . = 'a' or . = 'b' or . = 'd' Another option is to create a node set containing the values that you're interested in, and use the existential semantics of = to do the test. So if you have $values be set to a node set that contains the following elements: <value>a</value> <value>b</value> <value>d</value> then you can just do: . = $values Creating the node set is a little tricky - you can put the XML in a separate document or embed it in the stylesheet, and use the document() function to access it; or you can create a variable holding a result tree fragment with those value elements in it, and then convert that to a node set with a implementation-specific node-set() extension function. --- This all becomes a lot easier in XPath 2.0. With XPath 2.0, you just do: . = ('a', 'b', 'd') and there you have it. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] SETS comparison..?, Martijn | Thread | RE: [xsl] SETS comparison..?, Michael Kay |
Re: [xsl] How to Create Side Heads , G. Ken Holman | Date | Re: [xsl] How to Create Side Heads , W. Eliot Kimber |
Month |