xsl-list
[Top] [All Lists]

RE: How to do an OR within SELECT for a variable

2005-08-21 05:16:08
Can I use something like :

<xsl:variable name="var" select="A/B/C|X/D/@ID" />

I think this gets interpretted as 'A/B/C' or 'X/D/@ID'

    You think correctly.
    
    I spell it out, but there may be a more succinct way.

    <xsl:variable name="var" select="A/B/C/D/@ID|A/B/X/D/@ID"/>

In 2.0 you can write

select="A/B/(C|X)/D/@ID

You have to be careful with such rewrites. I believe this works for "|" but
I discovered that it doesn't work for "except": [A//B//* except A//C//*]
gives a different result from [A//(B except C)//*]. If there's anyone
listening who fancies doing some formal analysis of these expressions for an
M.Sc project, I'd love to see the answers...

Michael Kay
http://www.saxonica.com/ 



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>