Re: [xsl] Multiple search and replace

Subject: Re: [xsl] Multiple search and replace
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 2 Apr 2008 18:14:04 +0530
I suggest, you should try to get this book by Mike Kay:

http://www.amazon.com/XSLT-2-0-XPath-Programmers-Reference/dp/0470192747/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1207139807&sr=8-2

Mike has written this book covering both XSLT 2.0 and XPath 2.0.

Earlier there were separate books for XSLT 2.0 and XPath 2.0 from Mike.

Also if you aspire to be a great XSLT 2.0 programmer, you should read
the W3C specs (specified at, http://www.w3.org/Style/XSL/).

On 4/2/08, Pankaj Chaturvedi <pankaj.chaturvedi@xxxxxxxxx> wrote:
> By the way, I was googling around for free XSLT/XPATH 2.0 tutorials for
> newbee for start. Anybody can suggest the tutorial available for a kick
> start/test the new functionality of version 2.0.
>
> Thanks
>
> Pankaj
>
>
>
> -----Original Message-----
> From: Pankaj Chaturvedi [mailto:pankaj.chaturvedi@xxxxxxxxx]
> Sent: Wednesday, April 02, 2008 5:33 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Multiple search and replace
>
>
> Thanks Michael.
>
> Now it works. Amazingly I was getting the results using
> name(following-sibling::keyword[1]) construct or may be I was ignoring the
> warnings (if any).
>
> The construct in 1.0 means test="name(following-sibling::keyword[1])", that
> is, test the name of the first following sibling keyword. If this is what
> the code intends to be, then change it to add the "[1]". However, it very
> often indicates an error of some kind.
>
> Yes that's what exactly I was testing "the name of the first following
> sibling keyword" without specifying position. Hmmmm, I will be now more
> specific about syntaxes.
>
> Thanks
> Pankaj
>
>
>
> -----Original Message-----
> From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> Sent: Wednesday, April 02, 2008 4:58 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Multiple search and replace
>
>
> > I did tried to test by changing the "version' attribute value
> > to 2.0 but I am encountering another error at one of my line,
> > where I am using <xsl:if
> > test="name(following-sibling::keyword)"> Error: XPATH 2.0
> > expression, Too many items.
> >
> > This was perfect in 1.0.
>
> You mean, it didn't fail in 1.0.
>
> The construct in 1.0 means test="name(following-sibling::keyword[1])", that
> is, test the name of the first following sibling keyword. If this is what
> the code intends to be, then change it to add the "[1]". However, it very
> often indicates an error of some kind.
>
> In this case, if there is a following-sibling keyword then its name is
> "keyword", and if there is none, then name() gives "". In the first case the
> result of the test is "true", in the second case it is false. So you are
> really just testing, in a rather convoluted way, whether a following-sibling
> named keyword exists. So change the code to
>
>
> test="exists(following-sibling::keyword)"
>
> In fact, if you leave the version attribute saying version="1.0" then this
> is one of many cases where an XSLT 2.0 processor will execute your code in
> backwards-compatibility mode, which means you don't have to change anything,
> but can still use new features. Unfortunately though if you use XML Spy then
> the only way to use the XSLT 2.0 processor is if your stylesheet specifies
> version="2.0", which forces you to make such changes.
>
> Michael Kay
> http://www.saxonica.com/


-- 
Regards,
Mukul Gandhi

Current Thread