[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XPath condition testing, can pretty-print affect?
On 10/27/2011 04:00 PM, Karlmarx R wrote: > <root xmlns:....> > <Desc> > <dc:title> > <sc>TEXT</sc> > </dc:title> > <Many-Other-elements/> > </Desc> > </root> > > The previously mentioned xpath rule perfectly works in the 2nd case, > after pretty-print. But the rule does not give desired output on the > source one-liner XML. Inspite of <dc:title/> having TEXT, it keeps > sending the failure massage which is not what is expected. I do > understand in certain cases pretty-print can affect certain things, > but I have not explored much in this matter and any suggestion or > pointer towards this would be of help. Ah, but dc:title does *not* have TEXT. It has newline, many spaces, TEXT, newline, many spaces. Your regexp has a start ^ and end $ anchor, meaning it matches if *all* of the content is only alphanumeric. The leading and trailing whitespace introduced by pretty-printing does not match. Either use strip-space in your parser (or XSLT, if in that context), or match on sc if appropriate, or amend your regexp to allow leading and trailing whitespace. ~Chris -- Chris Maden, text nerd <URL: http://crism.maden.org/ > bBe wary of great leaders. Hope that there are many, many small leaders.b b Pete Seeger
|
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
|