aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSLT Stylesheet test for special character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT Stylesheet test for special character" Watch "XSLT Stylesheet test for special character" New topic
Author

XSLT Stylesheet test for special character

Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi All,

I need some assistance to compare a string value of an node before deciding on what child element/attribute to extract from. Here are the detail as follows:


I have no problem with test="Firstname" (line 6) but the ":" appears to be a special character that needs additional syntax (possible escape character) to pick up "Firstname:" together.

The error message has something like: Invalid QName on line 6 of stylesheet.

Your assistance would be very much appreciated.

Thanks,

Jack
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Did you try using
Firstname" ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8


That simply attempts to test if there is a child which is a "Firstname:" element. Of course there can't be one because that's not a valid name for an XML element. Start by describing the actual test which you want to do. Then write an XPath expression for that test. (Post the description here if you can't proceed.)
Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi Paul & Gamini,

I managed to get it working using test="contains(.,'Firstname:')".

The test="Firstname"" spat the dummy.

Thanks for trying anyway,

Jack
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XSLT Stylesheet test for special character