On Sep 12, 2004, at 1:58 PM, Michael Kay wrote:
A repetition count in a regex is indicated by curly braces, not square
brackets. Remember also that in an attribute value template, curly
braces
must be doubled.
Oops; I should have realized that. Thanks.
OK, followup:
I'm writing this to take a newspaper xhtml file and clean it up.
Within paragraphs, there are just two things I want to do: 1) convert
fake quotes to <q> elements, and b) to change graphic dropcaps like
this ...
<p><img src="http://graphics7.nytimes.com/images/dropcap/m.gif"
width="37" height="33" align="left" border="0" alt="M" />OSCOW,
....</p>
.... to text. So the below template handles the quotes, but I don't
really understand how to get the child xhtml:img template to apply.
<xsl:template match="xhtml:p">
<p>
<xsl:analyze-string flags="s" select="." regex='"(.*?)"'>
<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>
Also, is there some reasonably reliable way -- again using xslt 2.0 --
to take this ...
<meta name="byl" content="By C. J. CHIVERS and STEVEN LEE MYERS" />
.... and turn it into this:
<meta name="author" content="Chivers, C. J." />
<meta name="author" content="Myers, Steven Lee" />
Bruce