xsl-list
[Top] [All Lists]

RE: [xsl] Compact XPath syntax

2007-12-19 17:40:28

//c  seems to be what you are looking for.

In XSLT2, with a schema aware processor, in some limited 
situations, you may be able to use knowledge of a schema to 
make such optimsations but in general this is not possible.


Saxon-SA will rewrite //c as /a/b/c provided that the type of the context
node is statically known. It is generally good practice to declare type
information when writing schema-aware stylesheets, for example

<xsl:template match="document-node(schema-element(fpml:FPML))">
  <xsl:value-of select="//x"/>
</xsl:template>

The type information can be used both for optimization and for better error
checking: with a complex schema like FPML, it's very useful to be able to
abbreviate your path expressions (which can otherwise be immensely long)
without incurring any performance penalty.

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>