Subject: xsl:analyze-string and line break
From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx>
Date: Wed, 10 Oct 2007 12:28:55 +0200
|
Hello,
I am trying to do a regex on an expression with line breaks, for
some reason '.' does not include line break. I also tried [.\n]* to
say anything including line break, with no luck.
xml file is:
<?xml version="1.0"?>
<description>Sex of the named patient. Enumerated Values:
M = male
F = female
O = other</description>
and xsl file is:
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template name="parse-enum">
<xsl:param name="text"/>
<xsl:analyze-string select="$text" regex="\n">
<xsl:matching-substring>
<!--br/-->
</xsl:matching-substring>
<xsl:non-matching-substring>
<enum>
<xsl:value-of select="."/>
</enum>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
<xsl:template match="/description">
<xsl:analyze-string select="." regex=".*Enumerated Values:([.\n]*)">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>
</xsl:transform>
Thanks,
--
Mathieu
|