[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Ganesh Babu N wrote:
This would do:
</xsl:stylesheet>
--
Re: [xsl] splitting the content at each and every element
Subject: Re: [xsl] splitting the content at each and every element From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Wed, 27 May 2009 15:15:00 +0200 |
Ganesh Babu N wrote:
My input :
<article> <para>Countering misinformation <bold>about</bold> vaccines has become an urgent priority to assure the continued success of immunization programs. Fortunately, parents continue to seek information as well as the means to validate what they find. They also are seeking to identify trusted health providers to give them more information and guidance.</para> </article>
Required output:
<text> <parastyle> <characterstyle style="para"> <content>Countering misinformation</content> </characterstyle> <characterstyle type="bold"> <content>about</content> </characterstyle> <characterstyle type="para"> <content> vaccines has become an urgent priority to assure the continued success of immunization programs. Fortunately, parents continue to seek information as well as the means to validate what they find. They also are seeking to identify trusted health providers to give them more information and guidance</content> </characterstyle> </parastyle> </text>
This would do:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/>
<xsl:template match="para"> <parastyle> <xsl:apply-templates/> </parastyle> </xsl:template>
<xsl:template match="para/text()"> <characterstyle style="para"> <content> <xsl:value-of select="."/> </content> </characterstyle> </xsl:template>
<xsl:template match="para/*"> <characterstyle type="{name()}"> <content> <xsl:apply-templates/> </content> </characterstyle> </xsl:template>
<xsl:template match="article"> <text> <xsl:apply-templates/> </text> </xsl:template>
</xsl:stylesheet>
--
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] splitting the content at each, Ganesh Babu N | Thread | [xsl] HTML to XML, Knight, Michel |
[xsl] splitting the content at each, Ganesh Babu N | Date | [xsl] HTML to XML, Knight, Michel |
Month |