Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: hieratical xml transformation

From: delirio <migdemelo@----------.--->
To: NULL
Date: 6/6/2007 4:28:00 PM

On Jun 6, 4:30 pm, "Mark Goldin" <mgol...@ufandd.com> wrote:
> I am testing it and it does not produce any xml.
>
> "delirio" <migdem...@googlemail.com> wrote in message
>
> news:1181143254.225646.185460@q......
>
> > On Jun 6, 3:34 pm, "Mark Goldin" <mgol...@ufandd.com> wrote:
> >> I have an xml file that is an attribute based. That file has hieratical
> >> structure.
> >> Here is a sample of it:
> >> <?xml version="1.0" encoding="windows-1252"?>
> >> <menu name1="test1" name2="test2">
> >>  <menu name1="test1" name2="test2"></menu>
> >>  <menu name1="test3" name2="test4"></menu>
> >>  <menu name1="test5" name2="test6">
> >>   <menu name1="test7" name2="test8"></menu>
> >>   <menu name1="test9" name2="test10"></menu>
> >>  </menu>
> >> </menu>
>
> >> Is it possible to transform it into another xml but element based?
>
> >> Thanks
>
> >    <xsl:template match="menu">
> >        <menu>
> >            <xsl:apply-templates select="@*"/>
> >            <xsl:apply-templates select="menu"/>
> >        </menu>
> >    </xsl:template>
>
> >    <xsl:template match="@*">
> >        <xsl:element name="{name()}">
> >            <xsl:value-of select="."/>
> >        </xsl:element>
> >    </xsl:template>

works a treat for me . . . what processor are you using?
I tried a few processors myself . . .

it produces::

<?xml version="1.0" encoding="utf-8"?>
<menu>
   <name1>test1</name1>
   <name2>test2</name2>
   <menu>
      <name1>test1</name1>
      <name2>test2</name2>
   </menu>
   <menu>
      <name1>test3</name1>
      <name2>test4</name2>
   </menu>
   <menu>
      <name1>test5</name1>
      <name2>test6</name2>
      <menu>
         <name1>test7</name1>
         <name2>test8</name2>
      </menu>
      <menu>
         <name1>test9</name1>
         <name2>test10</name2>
      </menu>
   </menu>
</menu>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent