xsl-list
[Top] [All Lists]

Attribute Name to Elements Problems

2005-07-20 13:53:21
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="{(_at_)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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>