Subject: Re: [xsl] regex and tab-delimited text From: Terry Ofner <tofner@xxxxxxxxxxx> Date: Thu, 17 Jan 2008 17:19:27 -0500 |
Snippet of xml input: <test> <question> 2 <stem>As used in the sentence below, what is the denotation of the word <i>mutt</i>?</stem> <display>“What is that mutt doing in our yard?” asked Dad.</display> <choices> A animal B dog C creature D pet </choices> </question> </test>
I am trying to wrap each answer choice with the corresponding <choice- x> element:
<choices> <choice-a>animal</choice-a> <choice-b>dog</choice-b> <choice-c>creature</choice-c> <choice-d>pet</choice-d> </choices>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
<xsl:template match="/test/question/choices"> <choice-a><xsl:copy-of select="replace(.,'\tA\t(.*?) \r','$1')"/></choice-a> </xsl:template> </xsl:stylesheet>
<question> 2 <stem>As used in the sentence below, what is the denotation of the word <i>mutt</i>?</stem> <display>What is that mutt doing in our yard? asked Dad.</ display> <choice-a> A animal B dog C creature D pet</choice-a> </question>
On 1/17/08, Terry Ofner wrote:My question has to do with the fact that \t does not seem to work...
I should work. It is part of REGEX in XSLT building on REGEX in XML Schema: http://www.w3.org/TR/xmlschema-2/#regexs
Cheers, Jesper Tverskov http://www.xmlplease.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] regex and tab-delimited t, Jesper Tverskov | Thread | Re: [xsl] regex and tab-delimited t, David Carlisle |
Re: [xsl] regex and tab-delimited t, Jesper Tverskov | Date | Re: [xsl] regex and tab-delimited t, David Carlisle |
Month |