• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XSLT Stylesheet test for special character

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try using
Firstname" ?
 
Sheriff
Posts: 28329
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul & Gamini,

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

The test="Firstname"" spat the dummy.

Thanks for trying anyway,

Jack
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic