|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: apply-templates and priorities
Priority is only used to decide which template to apply when you have two template rules that match the same node. "/" matches root nodes (called document nodes in XSLT 2.0), while "*" matches element nodes, so there is never any conflict between these two rules, and therefore no need to consider their relative priority. Michael Kay > -----Original Message----- > From: simon_handley@xxxxxxxxxxx [mailto:simon_handley@xxxxxxxxxxx] > Sent: 15 September 2004 22:56 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: apply-templates and priorities > > I'm confused about how the priorities of templates are > computed. Using > saxon 8.0, this stylesheet: > > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > <xsl:template match="*" priority="1"> > <xsl:message>in first</xsl:message> > </xsl:template> > > <xsl:template match="/" priority="10"> > <xsl:message>in second</xsl:message> > </xsl:template> > </xsl:stylesheet> > > and an arbitrary source doc produces the message "in second" > (as expected). > > Now if I switch around the priorities: > > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > <xsl:template match="*" priority="10"> > <xsl:message>in first</xsl:message> > </xsl:template> > > <xsl:template match="/" priority="1"> > <xsl:message>in second</xsl:message> > </xsl:template> > </xsl:stylesheet> > > Then I still get "in second" (NOT as expected). Note that if the > patterns are the same then this behaviour goes away (the latter > case produces "in first"). Also, I see the same behaviour in earlier > versions of saxon. > > My understanding of these things is that the default > priorities for the > two templates are different (as per section 5.5 of the 1.0 spec), but > that the explicit priority just overrides the default priorities. Is > something else going on, or have I missed something really simple? > > Thanks, > > Simon > > -------------------------------------------------------------- > ---------- > Simon Handley > Agilent Technologies > 5301 Stevens Creek Boulevard, MS WH > Santa Clara, California 95051-7295 > simon_handley@xxxxxxxxxxx > 408-553-7122 (w) 408-553-7269 (fax) > > --+------------------------------------------------------------------ > 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@xxxxxxxxxxxxxxxxxxxxxx> > --+--
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








