mixed content nodes question
I'm really new to XSL and I'm having trouble figuring out how to do what seem to be fairly basic things. For example, say I have the following file:
<root> <child> <leaf>Leaf Value1</leaf> <leaf>Leaf Value2</leaf> </child> <child> <leaf>Leaf Value <dictionary lookup="3"/> 3</leaf> </child> </root>
and I wanted to transform it very simply to:
<root> <child> <leaf>Leaf Value1</leaf> <leaf>Leaf Value2</leaf> </child> <child> <leaf>Leaf Value Foo 3</leaf> </child> </root>
I'd imagine I'd have some part of my xsl sheet include a long 'when' block and switch on the lookup attribute's values so i'd have:
But I can't figure out how to do the actual transforming of only those <dictionary> tags in place, leaving the rest of the file unchanged. I've tried apply-templates in the a template matching "/", then having a template matching "*" do a test to see if the current node is <dictionary>, if so, transform and write out, otherwise, write out as it is, but I can't get it to work right.
If it's vastly easier to process if instead of having: <dictionary lookup="3"/> -> Foo I have: <dictionary>3</dictionary> -> Foo
I might be able to make that change to the xml format, but I'm still confused about how to deal with mixed nodes. I feel like people must do this all the time, if they have bits of HTML embedded in larger XML trees they must have markup tags like <b>, <a> that make the nodes mixed content, but I can't find a good example of it.
Also, I keep coming across vague references to the fact that MSXSL.exe v3 is perhaps not the ideal way of transforming my xml docs. Given that I'm on windows, is there a better tool to use?
Any help or pointers to help would be greatly appreciated, jeb.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format