This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Getting the attributes & subchild elements data using XSL
- From: "Shaik Zulfakhar Ali" <shaik at pps dot sdl dot melco dot co dot jp>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 29 Mar 2002 12:07:59 +0900
- Subject: [xsl] Re: Getting the attributes & subchild elements data using XSL
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Hi All,
>
> Is it possible to display all the attribute name & values & child elements
> names with attribute name & values & its text node values in the order
they
> placed in the xml document
>
> ie. By simply using root node name.
>
> Because the inner child elements will be varying every time. Is there any
> generic way of doing this ?
>
> <part> & <spec-summary> will be always there but its child elements
may
> vary.
>
>
> I have an xml file like below:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <?xml-stylesheet type="text/xsl" href="Gen3.xsl"?>
>
> <part name="TR1" category="TR">
>
> <spec-summary>
> <phase value="3" />
> <transformation type="voltage">
> <primary connection="wye">66000</primary>
> <secondary connection="delta">6600</secondary>
> </transformation>
> <capacity unit="VA">5000000</capacity>
> <cooling-method type="GNAN" />
> <impedance type="%Z">7.5
> <accuracy min="-10%" max="+10%" />
> </impedance>
> </spec-summary>
>
> </part>
>
> and wrote the XSL file like below:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsl:stylesheet version = '1.0'
> xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
>
> <xsl:template match="part/spec-summary/node() | part/spec-summary/@*">
>
> <xsl:apply-templates select="node() | @*"/> <br />,
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> But i want the o/p like :
>
> phase value = 3
> transformation type = voltage
> primary connection = wye
> 66000
> secondary connection = delta
> 6600
> capacity unit=VA
> 5000000
> cooling-method type = GNAN
> impedance type = %Z
> accuracy min = -10%
> max = +10%
>
> Please help me in solving this.
>
>
> Thanks
> Zulfakhar
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list