[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 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/
|
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
|