Subject: Re: [xsl] priority of key patterns From: Michael Kay <mike@xxxxxxxxxxxx> Date: Wed, 14 Nov 2012 08:48:58 +0000 |
Yes (the spec is fairly clear, I think).Would I be right in concluding that the default priority of the first template below that features a call to a key function in the match pattern is 0.5.
Your second template rule is rather peculiar, because the first alternative (*) embraces the second (Payloadfile); except that they have different priorities, so this is almost equivalent to writing a match="*" template with priority -0.5, and a match=Payloadfile template with priority 0. Unless there's another template rule with intervening priority, the second half of the union is pointless.
<xsl:template match="key('privateData','private')" priority="-0.1"> <private oldName="{local-name()}"> <xsl:apply-templates select="node()|@*"/> </private> </xsl:template>
<xsl:template match="*|PayloadFile"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="node()|@*"/> </xsl:element>
Fine. So? That's what priorities are for.I found myself having to override the priority in order to ensure that the PayloadFile element (otherwise caught by the key) would be processed by the 2nd template rule.
Yes. Patterns become less restrictive in XSLT 3.0. Unfortunately this makes the default priority rules even more complicated.
On an unrelated note not worth starting a new thread, I tried using except in an xsl:key match clause - which was rejected. I presume it is one of those pattern rules that I keep falling foul of (XSLT 2.0).
Michael Kay Saxonica
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] priority of key patterns, Ihe Onwuka | Thread | Re: [xsl] priority of key patterns, Ihe Onwuka |
[xsl] priority of key patterns, Ihe Onwuka | Date | Re: [xsl] priority of key patterns, Ihe Onwuka |
Month |