[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Handling ' ' in source xml
> I hope this isn't covered in the nbsp faq and I'm just > not seeing it... :( er yes this is exactly the issue the faq tries to cover:-) It's very hard to get a faq on nbsp, as if people see what's happening enough to know what question to look up in the faq, then they don't have a problem any more:-) > Basically the source xml i'm converting to xml, has a > lot of sequences in it. That could mean one of two things. Either you have a documennt like <foo> ... ... </foo> or you have a document like <!DOCTYPE foo SYSTEM "some dtd that defines nbsp, most likley to being #160"> <foo> ... ... </foo> In the first case all bets are off: your input is not well formed, and you will get a fatal parse error from _any_ XML application, XSLT included. In the second case all you need remember is that the input is processed by an XML parser _before_ XSLT sees it and XML parsers replace character and entityreferences by the characters that they reference. So here the input to XSLt does _not_ have an nbsp entity reference, it has a character as literal data, just as if it had been typed at the keyboard. The character is number 160, so if your editor allows yoyu to enter characters by number you can just do that, or you can use a numeric character reference such as & # 1 6 0 ; which again will be processed by teh XML parser (when parsing the stylesheet) so XSLT will see the actual character not the character reference. text()[contains(self::node(), '& # 1 6 0 ;')] or nore simply text()[contains(., '& # 1 6 0 ;')] or (perhaps, depending on context) contains(text(), '& # 1 6 0 ;') David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
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
|