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

RE: A non self closed xsl:apply-templates element to

Subject: RE: A non self closed xsl:apply-templates element to create a text node for matching ...
From: iwantto keepanon <iwanttokeepanon@xxxxxxxx>
Date: Tue, 5 Dec 2006 22:49:28 +0300 (MSK)
xsl apply templates image
Subject: RE:  A non self closed xsl:apply-templates element to create a text node for matching ...

>It's not legal to have an xsl:value-of element as a child of
>xsl:apply-templates, and I'm really not sure what you would expect it to
>mean.

I didn't think so.  Just an "accident" that it worked.

>I can't see the difficulty in having a single template rule that matches
>both text nodes and attribute nodes, for example

It's just that the matching rules are quite long and if I change one I have
to change the other.  Whether in one template or in 2 different ones, the
chance of error is greater than having the rules in one place.

How can I combine these 2 templates (image the starts-with being long and error prone)
so that I can state the matching rules only once:

<xsl:template match="text()[ starts-with( ., '../Russia2006/' ) ]">
    <xsl:text>http://site.com/gallery/Russia/2006/</xsl:text>
    <xsl:value-of select="substring-after( ., '../Russia2006/' )" />
</xsl:template>

<xsl:template match="@href[ starts-with( ., '../Russia2006/' ) ]">
    <xsl:text>http://site.com/gallery/Russia/2006/</xsl:text>
    <xsl:value-of select="substring-after( ., '../Russia2006/' )" />
</xsl:template>

Something like a union would be nice : (text() | @href)[ ... ]
I am just trying to simplify a big stylesheet.  Any ideas?

BTW, thanks for the quick response already ....
-- 
Rodman

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.