This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Are these two the equivalent?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Are these two the equivalent?
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 15 Oct 2001 11:56:36 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Example 2 should return an error. The union operator "|" must take node-sets
as its operands. You can rewrite it using the "or" operator, which takes
booleans as its operands.
It's easy to make the mistake of reading "|" as "or", because if A and B are
node-sets, then <xsl:if test="A|B"> means the same as <xsl:if test="A or B">
Mike Kay
>
> Example 1 gives me what I want, Example 2 does not. To me they are the
> same...If they are different, could someone explain to me why
> the second
> does not give me what I want.
>
> Thanks in advance,
> Nicholas Waltham
>
>
>
>
> Example 1:
> <xsl:template
> match="p[@style='L1'][preceding-sibling::p[last()][@style='L1'
> ]|preceding-si
> bling::p[last()][@style='L2']|preceding-sibling::p[last()][@st
> yle='L3']]">
> <xsl:apply-templates/>
> </xsl:template>
>
> Example 2:
> <xsl:template
> match="p[@style='L1'][preceding-sibling::p[last()][@style='L1'
> |@style='L2'|@
> style='L3']]">
> <xsl:apply-templates/>
> </xsl:template>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list