xsl-list
[Top] [All Lists]

[xsl] Recognizing non-XML Markup Structure

2007-09-26 22:04:16
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--