[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

mixed content nodes question

Subject: mixed content nodes question
From: Jeb Boniakowski <jeb@xxxxxxxxxxx>
Date: Fri, 7 Jan 2005 13:35:38 -0500
mixed content in xml node
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.