|
Subject: [xsl] Attribute Name to Elements Problems From: "Benjamin Richard Woline" <valjean@xxxxxxxxxxx> Date: Wed, 20 Jul 2005 15:53:21 -0500 (CDT) |
Now that I have my XML sorted (Thanks to DavidC) I can't seem to get the
structure to reform itself based on an attribute name.
My XML now looks like:
<Entry>
<Entry name="H" type="System" importance="1">
<Entry name="I" type="Category" importance="1">
<Entry name="J" type="Item" importance="1"></Entry>
<Entry name="K" type="Item" importance="2"></Entry>
</Entry>
<Entry name="L" type="Category" importance="2">
<Entry name="N" type="Item" importance="1"></Entry>
<Entry name="M" type="Item" importance="2"></Entry>
</Entry>
</Entry>
<Entry name="A" type="System" importance="2">
<Entry name="E" type="Category" importance="1">
<Entry name="G" type="Item" importance="1"></Entry>
<Entry name="F" type="Item" importance="2"></Entry>
</Entry>
<Entry name="B" type="Category" importance="2">
<Entry name="C" type="Item" importance="1"></Entry>
<Entry name="D" type="Item" importance="2"></Entry>
</Entry>
</Entry>
</Entry>
I want to reform it by "type" with some new elements created so that the XML
looks like:
<Entry>
<System type="System" importance="1"><name>H</name>
<Category type="Category" importance="1"><name>I</name>
<Item type="Item" importance="1"><name>J</name></Item>
<Item type="Item" importance="2"><name>K</name></Item>
</Category>
<Category type="Category" importance="2"><name>L</name>
<Item type="Item" importance="1"><name>N</name></Item>
<Item type="Item" importance="2"><name>M</name></Item>
</Category>
</System>
<System type="System" importance="2"><name>A</name>
<Category type="Category" importance="1"><name>E</name>
<Item type="Item" importance="1"><name>G</name></Item>
<Item type="Item" importance="2"><name>F</name></Item>
</Category>
<Category type="Category" importance="2"><name>B</name>
<Item type="Item" importance="1"><name>C</name></Entry>
<Item type="Item" importance="2"><name>D</name></Entry>
</Category>
</System>
</Entry>
When I try something with <xsl:element name="{@Type}"> I get not valid type not
a QName, so something is very wrong. There are several attributes other than
name that I want to pull out into elements so hopefully there is a "generic"
solution. Hope someone can help.
Ben Woline
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: RE: [xsl] Combining two XML fil, Karl Koch | Thread | RE: [xsl] Attribute Name to Element, Joe Heidenreich |
| Re: [xsl] "Debugging" XSLT? Experie, Mukul Gandhi | Date | RE: [xsl] Attribute Name to Element, Joe Heidenreich |
| Month |