[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: regex and tab-delimited text
Okay. So then my stylesheet needs to be adjusted somehow.
Here is what I am trying to do. 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> With my current stylesheet I am just trying to get choice A to work: <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> Current output: <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> Thanks in advance for any tips. Terry On Jan 17, 2008, at 3:48 PM, Jesper Tverskov wrote: On 1/17/08, Terry Ofner wrote:My question has to do with the fact that \t does not seem to work...
|
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
|