[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: regexp question
I would do it like this: <xsl:template match="img[matches(@src, '.*dropcap/.\.gif')]" mode="dropcap"> <xsl:value-of select="@alt"/> </xsl:template> <xsl:template match="xhtml:p"> <xsl:variable name="temp"> <xsl:apply-templates mode="dropcap"/> </xsl:variable> <p> <xsl:analyze-string flags="s" select="string($temp)" 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> > > 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. > > 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" /> > It all depends on how wide the variations are in your source data. If you want to do the above, while also changing "BOB DU CHARME" to "du Charme, Bob", then you have got an interesting challenge on your hands. Try to define the algorithm you want to use before you start asking how to code it in XSLT. Michael Kay
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|