[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi--
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:
and I wanted to transform it very simply to:
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:
<xsl:when test="3">Foo</xsl:when>
<xsl:when test="4">Bar</xsl:when>
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.
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?
[xsl] mixed content nodes question
Subject: [xsl] mixed content nodes question From: Jeb Boniakowski <jeb@xxxxxxxxxxx> Date: Fri, 7 Jan 2005 13:35:38 -0500 |
Hi--
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:
<xsl:when test="3">Foo</xsl:when>
<xsl:when test="4">Bar</xsl:when>
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Unparsed-text and charact, Michael Kay | Thread | RE: [xsl] mixed content nodes quest, Jim Neff |
RE: [xsl] Unparsed-text and charact, Michael Kay | Date | RE: [xsl] mixed content nodes quest, Jim Neff |
Month |