• 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

XML parsing by pattern matching

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have an XML file that contains recurring instances of tags like this:
<ABC-question-1>text</ABC-question-1>
<ABC-some-question></ABC-some-question>

tags like the above have similar ABC keyword for all occurrences and these tags donot necessarily apppear together in a particular block in the XML file.

I want to parse these tags with an xslt so as to display all these tags with ABC pattern group together in the output file.

Thanks in advance.
 
Marshal
Posts: 28177
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
Well, first of all if you have any control over the design of that XML document you should intervene to stop that from happening. Hiding variable information in an element name is bad design; that hidden information should be an attribute most likely, or perhaps text:

However if you're stuck with that design then there are two features you need: (1) there's a way to get the name of an element; (2) there's a function to decide whether a string starts with a particular sequence. Hopefully that should get you started.
 
Paul Clapham
Marshal
Posts: 28177
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
And, welcome to the Ranch!
 
reply
    Bookmark Topic Watch Topic
  • New Topic