Very sorry about that. I won’t post generic xslt/xpath questions here again.  And thanks for your reply – I couldn’t find any document detailing the definition of a “pattern”.

 

Steve

 

From: Michael Kay [mailto:mike@saxonica.com]
Sent: Wednesday, November 05, 2008 6:03 PM
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] template match syntax vs. select syntax

 

This list is for questions about the Saxon product - questions about the XSLT language belong elsewhere, for example the xsl-list at mulberrytech.com.

 

But this one is very easily answered by looking at the language spec or at any tutorial or reference book. The match attribute is NOT an XPath expression, it is a "pattern", which accepts a subset of the syntax of XPath expressions.

 

You can achieve what you want using

 

match="*[not(self::Person or self::Cat)]"

 

or more usually, by having a higher priority template rule to match Person and Cat elements. In fact the default priorities handle it:

 

<xsl:tempate match="*">

  ....

</xsl:template>

 

<xsl:template match="Person|Cat">

....

</xsl:template>

 

Michael Kay

http://www.saxonica.com/

 


From: Stephen Caffo [mailto:steve@mailbranch.com]
Sent: 05 November 2008 20:11
To: saxon-help@lists.sourceforge.net
Subject: [saxon] template match syntax vs. select syntax

Can somebody please explain the difference between the syntax used for the match attribute in an xsl:template, and the select attribute used in xsl:apply-templates

I can’t understand the difference – I thought they were both XPath expressions, with the same syntax.  Is match defined as a predicate only?  And how can one use the “except” keyword in a match pattern?

 

Thanks!

Steve

 

 

 

<!--This works-->

<xsl:template match="@* | node()">

      <xsl:copy>

            <xsl:apply-templates select="@* | (node()  except (mstns:Person, mstns:Cat))"/>

      </xsl:copy>

</xsl:template>

 

 

<!--This does not work-->

<xsl:template match="@* | (node()  except (mstns:Person, mstns:Cat))">

  <xsl:copy>

    <xsl:apply-templates select="@* | node()"/>

  </xsl:copy>

</xsl:template>