Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] A non self closed xsl:apply-templates element to create a text node for matching ...

From: iwantto keepanon <iwanttokeepanon@-------->
To:
Date: 12/5/2006 7:50:00 PM
Subject: RE: [xsl] 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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent