Subject: RE: [xsl] using xsl:value-of but omitting some children - possible? From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx> Date: Thu, 27 Jan 2005 15:24:06 -0000 |
> Hello! > > I have problems with the following fragment: > > <somewheredeep> > <chaptertitle> > our title > <part> > has some parts > </part> > <ugly> > some ugly things here > </ugly> > </chaptertitle> > </somewheredeep> > > I have the folloowing structure of templates > > <xsl:temaplate match="somewheredeep"> > <xsl:variable name="chaptitle"> > <xsl:call-template name="getchaptitle"/> > </xsl:variable> > <!-- I use $chaptitle several times here --> </xsl:template> > > <xsl:template name="getchaptitle"> > <xsl:value-of select="chaptertitle"> > </xsl:template> Change the above named template to use apply-templates instead of value-of: <xsl:template name="getchaptitle"> <xsl:apply-templates select="chaptertitle"/> </xsl:template> And then add a 'no-op' template for <ugly>: <xsl:template match="ugly"/> This will ensure if there is any text after your <ugly> element it gets processed as well. If you already have template for <ugly> that does something else, you will want to use a mode on the no-op template. cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] using xsl:value-of but om, Jarno.Elovirta | Thread | [xsl] "Passing through" special cha, David.McKay |
RE: [xsl] using xsl:value-of but om, Jarno.Elovirta | Date | RE: [xsl] conditional instruction v, Jarno.Elovirta |
Month |