xsl-list
[Top] [All Lists]

Re: regexs, grouping (?) and XSLT2?

2004-08-07 18:37:31

On Aug 7, 2004, at 3:43 PM, Bruce D'Arcus wrote:

I have paragraphs like:

<p>A "quote."</p>

I want the quotes converted to XHTML tags. The following code doesn't work, or did any other variation I tried:

I figured out this part:

<xsl:template match="xhtml:p">
  <p>
    <xsl:analyze-string select="." regex='"(.*?|.*?\n.*?)"'>
      <xsl:matching-substring>
        <q><xsl:value-of select="regex-group(1)"/></q>
      </xsl:matching-substring>
      <xsl:non-matching-substring>
        <xsl:value-of select="."/>
      </xsl:non-matching-substring>
    </xsl:analyze-string>
  </p>
</xsl:template>

Bruce