![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL to handle splitting an XML Tag to Multiple XML Tags [Thread Next] Re: XSL to handle splitting an XML Tag to Multiple XML TagsTo: NULL Date: 2/14/2007 2:02:00 PM
Amit wrote:
> I want to divide the writer name in two parts: 'tom' 'carl' through
> xsl.
> <writer>tomcarl</writer>
> <writer1>tom</writer1>
> <writer2>carl</writer2>
Start with the identity transformation e.g.
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
then add a template for writer elements that creates two elements
<xsl:template match="writer">
<writer1><xsl:value-of select="substring(., 1, 3)"/></writer1>
<writer2><xsl:value-of select="substring(., 4)"/></writer2>
</xsl:template>
You have not made it clear what the criteria are for splitting the
strings so I have simply used the substring function.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
