Monday, January 10, 2011

XSTL: match xmlns

Hello people!
This is my first post of the year and I want to start with something which was driving me crazy for 2 days in a row.
I have a XML which I want to transform into another format by using XSTL:
Input XML
If you look carefuly to my input XML, there is something new:
This kind of tag requires some special extra work, because if XML'd come without these extra stuff, like this: My work'd be really easy :D
To solve this issue I have to add these extra information on my stylesheet:
xmlns:n="http://pos.odc.vzwcorp.com" exclude-result-prefixes="n"
Why "n"? Because I wanted :P, I could be using juan, pedro, etc.
Then on my XPath expressions I have to include my prefix on each tag I'm looking for: n:POSServices, n:ServiceBody/n:cmEligibilityCheck/n:response/n:mtn
my XSTL
And finally what you'll get is what you're expecting ;)
Output XML

No comments:

Post a Comment