[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Recognizing non-XML Markup Structure
Subject: [xsl] Recognizing non-XML Markup Structure
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Thu, 27 Sep 2007 10:32:51 +0530
|
First of all I want to thanks all the xslt user who support others by
prompt reply.
I am now trying to learn role of regex within XSLT and tried it by the
example here
http://www.w3.org/TR/xslt20/#function-regex-group
Problem: replace all occurrences of [...] in the para by cite elements,
retaining the content between the square brackets as the content of the new
element.
XML
<para>Hoping to satisfy [...] the secrets of ecstatic love, the roots of
personal happiness.</para>
Stylesheet:
<xsl:analyze-string select="para" regex="\[(.*?)\]">
<xsl:matching-substring>
<cite>joga<xsl:value-of select="regex-group(1)"/></cite>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
<xsl:template match="para">
<a><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute></a>
<p align="justify"
style="margin-top:0pt;margin-bottom:0pt"><xsl:apply-templates/></p>
</xsl:template>
ERROR
XSL:Analyze-string must not appear directly within xsl:stylesheet
thanks
...JSR
|