Subject: Re: [xsl] analyze-string question From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Fri, 26 Oct 2012 09:17:05 +0200 |
Dear XSLT-list,
For an up-conversion of a plain-text word-list with grammatical classification information to XML, I've been a file with lines like the following:
DRUG<OJ MO <MS-P <P 3V>>
What if an alt group starts with a vowel? DRUG<OJ MO <AS-P <P 3V>>
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="my" version="2.0" exclude-result-prefixes="my xs" >
<xsl:template match="p"> <xsl:copy> <xsl:sequence select="my:wrap-nested(., '<([^aeiou].+)>')"/> </xsl:copy> </xsl:template>
<xsl:function name="my:stress" as="node()*"> <xsl:param name="string" as="xs:string" /> <xsl:analyze-string select="$string" regex="<([aeiou])" flags="i"> <xsl:matching-substring> <stress> <xsl:value-of select="regex-group(1)"/> </stress> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:function>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] analyze-string question, Michael Kay | Thread | Re: [xsl] analyze-string question, Wendell Piez |
Re: [xsl] analyze-string question, Michael Kay | Date | Re: [xsl] transform html h1 with a , Giuseppe Briotti |
Month |