[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: regexp question

Subject: Re: regexp question
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Sun, 12 Sep 2004 16:22:34 -0400
xhtml img regex
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='&quot;(.*?)&quot;'>
      <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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.