|
Subject:
|
Manipulating strings
|
|
Posted By:
|
dzisaacs
|
Post Date:
|
12/24/2005 3:06:04 PM
|
ok let's say i have an xml file like this
<index>
<p>Introduction 109 Author Message 200 About 334</p>
</index>
I need to write an xslt that can make that paragraph looking like this
Introduction 109 Author Message 200 About 334
I'm not sure how can i do this...My guess is that I need to look for a number and when i find the number put an end line and keep doing this till i get to the end..
i think this is the idea but i don't know how to implement it on xslt
|
|
Reply By:
|
raman27
|
Reply Date:
|
12/26/2005 2:22:00 AM
|
hi
try this one
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="indexes"> <xsl:for-each select="index/p">
<xsl:analyze-string select="." regex="([A-z ]+)([0-9]+)"> <xsl:matching-substring> <xsl:value-of select="regex-group(1)"/><xsl:value-of select="regex-group(2)"/><br/> </xsl:matching-substring> </xsl:analyze-string> </xsl:for-each> </xsl:template>
</xsl:stylesheet>
|
|
Reply By:
|
dzisaacs
|
Reply Date:
|
12/27/2005 9:52:39 AM
|
thank you very much, that answered my question
|