[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Reusing and XPath expression

Subject: Re: Reusing and XPath expression
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 3 Mar 2011 05:40:40 -0800
Re:  Reusing and XPath expression
> In XPath 3.0 you can use inline function items (dynamically generated
> function definitions).
>
> See an example of this here:
>
>
http://dnovatchev.wordpress.com/2011/02/08/the-binary-search-tree-data-struct
urehaving-fun-with-xpath-3-0/
>
> and here:
>
>
>
http://dnovatchev.wordpress.com/2011/02/20/the-set-datatype-implemented-in-xp
ath-3-0/


Because this has become possible, the right question now is: Can we
persists a set of (any) XPath function thus defined  -- such as in a
file, so that we have in XPath something similar to the xsl:include
(at least) feature?

>
>
>
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> Facts do not cease to exist because they are ignored.
>
>
>
>>
>> B  B <xsl:template match="cv:*/gl:title">
>> B  B  B  B <xsl:variable name="ancestors" select="count(ancestor::*)"/>
>> B  B  B  B <fo:block>
>> B  B  B  B  B  B <fo:inline
font-size="{($title-font-size)-2*$ancestors}pt">
>> B  B  B  B  B  B  B  B <xsl:apply-templates></xsl:apply-templates>
>> B  B  B  B  B  B </fo:inline>
>> B  B  B  B </fo:block>
>> B  B </xsl:template>
>>
>> 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.
>>
>> Kind regards,
>> Jacobus
>>
>>
>
>
>
> --
>



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.