Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About lithium

  • Rank
  1. Just the {$name} thing was what I needed, thanks!I think I have what I need now. But I'm curious: the output doesn't have a .dtd specified, is there a way to add one using the xsl sheet?
  2. Ok, what I really need to know is this:Let's say I have a tag <foo name="SomeSpecialValue">...and I want the output to have a tag like <bar name="SomeSpecialValue">...How can I get that? I can output <bar name="Constant"> but I want the name to be the output of <xsl:value-of select="@name"/>Is that possibe?
  3. The contents of the <bar>s are supposed to be child tags in <bar> But I should get some sleep, after trying again, I think I don't need the attributes at all... Thanks anyway ^^
  4. Scenario:I have XML files wich look like this:...<foo> <bar1></something></bar1> <bar2></something_different></bar2> <bar3></again_something_different></bar3></foo><foo> <bar1></something></bar> <bar2></something_different></bar2> <bar3></again_something_different></bar3></foo>...so there are many instances of <foo> with different data stored in them.What I want to have is this:...<foo name="1"> <bar1></something></bar1> <bar2></something_different></bar2></foo><foo name="2"> <bar1></something></bar1> <bar2></something_different></bar2></foo>...So I use <xsl:for-each select="foo"> to loop through all the <foo>s, output <foo> and then output <bar1> and <bar2> using <xsl:copy-of select="foo/bar"/>.The problem with this - naturally - is that I want only the corresponding <bar*> tags, not all of the document.Is there a way to only output the <bar*>s of the currently looped <foo>, eg, using the name attribute of <foo>?
  5. Ah, <xsl:copy-of> worked... I had used it the wrong way, now it works fine =)I think I can do this now, thanks!
  6. Thanks, I'm slowly starting to get somewhere =)As for "modify and copy the rest", if I do what you said, I end up with just the values, but I also need the tags. For example, the old XML has the following:... <network name="net0"/> <network name="net1"/> <network name="net2"/>...This has not changed in the new XML. How can I get all the <network> tags and corresponding attributes to the new file? Also, how can this be done with something like... <ip if="eth0"/></ip>...Again, I want that same line in the new XML file.
  7. I quickly read some of the XSLT ducumentation here on w3schools... As for "writing" the file, that is no problem anymore But a general question: do I see this correctly, I have to write a XSLT stylesheet with a definition for every tag used in my XML? What about tags that I don't want to change in any way, is there a way to first "copy" everything and then modify that copy, or at least, is there something like "if you find this tag, take it as it is for the output document"?
  8. Hi everyone.I have not done any work with XML yet but I have to solve a taks now and it would be very nice if you could point me to fitting documentation and tools.What I need to do is the transformation of an old XML file into a new version. Both are specified with a DTD. Scanning through the DTD tells me that I can remove most of the Tags that have changed, but I also need to insert one or two and change the Value of some Attributes.So this is not really a hard thing, it could be done using traditional text replacement systems, but I'm wondering what XML tools exist to do just that- reading XML file- removing obsolete Tags somewhere based on some definition- adding some Tags somewhere based on some definition- changing the Value of some Attributes based on some definition- writing the new XML fileI'm sure there are nice Tools for this. Any suggestions?
  • Create New...