|
Subject: RE: [xsl] Converting specific child elements into attriutes of pa rent From: "Sindigi, Ganesh K" <SindiGK@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 29 Oct 2003 19:16:07 -0700 |
Sorry about that. The desired o/p for this should be
<customer>
<field id="customerId">cust1</field>
<field id="customerName">Customer 1</field>
<fieldGroup id="homeAddress">
<fieldList>
<field id="street">98th Street</field>
<field id="city">Chicago</field>
</fieldList>
</fieldGroup>
<fieldGroup id="companyAddress">
<fieldList>
<field id="street">128th Street</field>
<field id="city">Chicago</field>
</fieldList>
</fieldGroup>
</customer>
-Ganesh.
-----Original Message-----
From: Mukul Gandhi [mailto:mukulgw3@xxxxxxxxx]
Sent: Wednesday, October 29, 2003 7:06 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Converting specific child elements into attriutes of
parent
Hi Ganesh,
If you can post the desired o/p, it'll be nice..
Regards,
Mukul
--- "Sindigi, Ganesh K"
<SindiGK@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> I have been trying to convert specific child
> elements into attributes of the
> parent node. I looked through archive, there was a
> topic of converting all
> children to attributes of the root. I followed the
> same thing and tried to
> convert a specific child element, but i am getting
> following error.
> elmToAtt.xsl; Line 18; Column -1; name() has an
> illegal attribute: {1}
> I would like to copy the xml document and convert
> only specific elements
> into attributes.
> I am not able to make out why this error is, but to
> no avail. Hoping that
> anybody in the list would help to resolve .
>
> (I had posted this on XSLTalk group, but i wasnt
> able to c the message, so
> re-posting this.)
>
> Thanks,
> Ganesh.
>
> Here is my styleSheet, elmToAtt.xsl:
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" indent="yes"/>
> <xsl:template match="*">
> <xsl:copy>
> <xsl:apply-templates select="@*"/>
> <xsl:apply-templates />
> </xsl:copy>
> </xsl:template>
> <xsl:template match="@*">
> <xsl:copy/>
> </xsl:template>
>
> <xsl:template match="id">
> <xsl:attribute name="name()">
> <xsl:value-of select="text()"/>
> </xsl:attribute>
> </xsl:template>
>
> <xsl:template match="value"><xsl:value-of
> select="text()"/></xsl:template>
> </xsl:stylesheet>
>
> Here is XML document:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <customerList>
> <customer>
> <field> <id>customerId</id>
> <value>cust1</value> </field>
> <field> <id>customerName</id> <value>Customer
> 1</value></field>
> <fieldGroup>
> <id>homeAddress</id>
> <fieldList>
> <field> <id>street</id> <value>98th
> Street </value></field>
> <field> <id>city</id>
> <value>Chicago</value></field>
> </fieldList>
> </fieldGroup>
> <fieldGroup>
> <id>companyAddress</id>
> <fieldList>
> <field> <id>street</id> <value>128th
> Street</value></field>
> <field> <id>city</id>
> <value>Chicago</value></field>
> </fieldList>
> </fieldGroup>
> </customer>...
> </customerList>
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Re: Converting specific child, Dimitre Novatchev | Thread | [xsl] Basic help needed., kaseykim |
| Re: [xsl] Converting specific child, Mukul Gandhi | Date | Re: [xsl] Selecting the first sente, Larry Kollar |
| Month |