Subject: Re: [xsl] Processing two documents, which order? From: Dave Pawson <davep@xxxxxxxxxxxxx> Date: Sat, 9 Apr 2011 08:20:50 +0100 |
On Fri, 08 Apr 2011 14:14:33 +0100 David Carlisle <davidc@xxxxxxxxx> wrote: Davids solution below works... with one oddity not explained by my understanding of regex in Java. I want to say any lc character, AND not( : | -) <xsl:analyze-string select="." regex="[a-z][a-z\--\-\-:]+"> works. But I don't know how. [a-z-[p]] excepts p from the range a-z Is this connected with my misunderstanding? given a keyword of three, test input of "xsl:three" I don't want three marking up? DaveP > > doc1 > <x> > <word>one</word> > <word>two</word> > <word>three</word> > <word>threesome</word> > <word>x-ray</word> > </x> > > doc2 > <body> > <p id="a">one hmmm not-one zzzzz three</p> > <p id="b">a two one tone three</p> > <p>zzz hhh aaa iii aaa x-ray hhh</p> > </body> > > > dp.xsl > > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:key name="w" match="word" use="."/> > > <xsl:template match="node()"> > <xsl:copy> > <xsl:copy-of select="@*"/> > <xsl:apply-templates/> > </xsl:copy> > </xsl:template> > > <xsl:template match="text()" priority="2"> > <xsl:analyze-string select="." regex="[A-Za-z][a-z---]+"> > <xsl:matching-substring> > <xsl:choose> > <xsl:when test="key('w',.,doc('doc1.xml'))"> > <property> > <xsl:value-of select="."/> > </property> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="."/> > </xsl:otherwise> > </xsl:choose> > </xsl:matching-substring> > <xsl:non-matching-substring> > <xsl:value-of select="."/> > </xsl:non-matching-substring> > </xsl:analyze-string> > </xsl:template> > > </xsl:stylesheet> > > > saxon9 doc2.xml dp.xsl > <?xml version="1.0" encoding="UTF-8"?><body> > <p id="a"><property>one</property> hmmm not-one zzzzz > <property>three</property></p> > <p id="b">a <property>two</property> <property>one</property> tone > <property>three</property></p> > <p>zzz hhh aaa iii aaa <property>x-ray</property> hhh</p> > </body> > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ________________________________________________________________________ > -- regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Processing two documents,, David Carlisle | Thread | Re: [xsl] Processing two documents,, Liam R E Quin |
Re: [xsl] Grouping siblings accordi, David Carlisle | Date | Re: [xsl] Processing two documents,, Liam R E Quin |
Month |