Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - strip tags of a subtree >Thread Next - Re: strip tags of a subtree Re: strip tags of a subtreeTo: NULL Date: 6/4/2004 9:43:00 AM <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="description"/>
</xsl:template>
<xsl:template match="/">
Value with no tags:
<xsl:call-template name="strip-tags">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="strip-tags">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '<')">
<xsl:value-of select="substring-before($text, '<')"/>
<xsl:call-template name="strip-tags">
<xsl:with-param name="text" select="substring-after($text,'>')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Regards,
Brian Peddle
http://savedbyzero.org
"Thomas Scheffler" <thomas_scheffler@h...> wrote in message
news:c9ptcf$93r$1@f......
> Hi,
>
> I am trying to take out all tags of a special xml subtree. It should of
> cause keep the text() nodes in the result.
>
> before:
>
> <description>
> Hi this is a sample to show <b>bold</b> and <i>italic</i> or <b><i>bold
> and italic</i></b> text.
> </description>
>
>
> after:
>
> <description>
> Hi this is a sample to show bold and italic or bold and italic text.
> </description>
>
>
> I had no success googling around but maybe someone here as an idea?
>
> Thanks in advance
>
> Thomas
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
