Subject: RE: [xsl] A non self closed xsl:apply-templates element to create a text node for matching ... From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 5 Dec 2006 23:23:01 -0000 |
> >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. It's a bug in the XSLT processor you were using. You might call that an accident, I don't. > > >I can't see the difficulty in having a single template rule that > >matches both text nodes and attribute nodes, for example > 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? > You can write a union, but unfortunately you have to repeat the predicate: <xsl:template match="text()[ starts-with( ., '../Russia2006/' ) ] | @href[ starts-with( ., '../Russia2006/' ) ]"> Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] A non self closed xsl:app, iwanttokeepanon | Thread | [xsl] Group-By and nested tables, Ernesto Chirinos |
Re: [xsl] [XSL-FO] How to adjust th, J.Pietschmann | Date | RE: [xsl] A non self closed xsl:app, Michael Kay |
Month |