• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which xslt tag to use to test for partial value in xml document

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to write an xslt which would select a value only if the value start with a particalur number like the one in quotes- "998-". I was wondering if the xsl:test tag can be used to only look for a part of value like this in a number like-- 998-3244545.If there is some other function can somebody please suggest how to use that function.

Thanks
Vanita
 
Marshal
Posts: 28226
95
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
The xsl:test element might do what you want. But be aware that it's an XSLT 2.0 element and if you want to use it, you are going to have to make sure you are using an XSLT processor that supports 2.0. The default processor in Java doesn't.

Personally I would just use the starts-with() XPath function.

And may I suggest that if you're going to be working with XSLT, you should get yourself an XSLT reference to look things up in? If you had one, you would have seen starts-with in the list of functions right away, and you wouldn't have to wait for somebody else to tell you about it.
 
Paul Clapham
Marshal
Posts: 28226
95
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
Vanita, I appreciate the PM you sent me. But for follow-ups to this thread, it's much better if they appear in the thread itself. That way other people can contribute to the thread.
 
vanita maram
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please suggest a good reference book for xslt
reply
    Bookmark Topic Watch Topic
  • New Topic