[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: Reusing and XPath expression
Subject: Re: Reusing and XPath expression|
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 03 Mar 2011 12:06:40 +0000
You seem to be looking for functions:
<xsl:function name="f:depth" as="xs:integer">
<xsl:param name="node" as="node()"/>
On 03/03/2011 11:56, Jacobus Reyneke wrote:
Is there some way to re-use just part of an XPath expression. Here I
made an attempt by assigning it to a variable, but the benefit of
doing it this way is very limited:
<xsl:variable name="ancestors" select="count(ancestor::*)"/>
In this example I resize the section titles in FO depending on the
depth of the title. Is there some way I can put the
"count(ancestor::*)" expression in one place and so re-use it in
different templates by 'calling' it? I cannot just make the expression
'global' because new values cannot be assigned to it.
This is just a question in an attempt to understand the mechanism of
re-using bits of XPath in an attempt to keep templates maintainable.
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