This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Newbie final Tag question
- From: "Macaulay,Malcolm (US)" <Malcolm dot Macaulay2 at cnare dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 24 Sep 2002 17:25:07 -0500
- Subject: RE: [xsl] Newbie final Tag question
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Rick,
Try this:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<prod>
<op>abc123</op>
</prod>
<prod>
<op>xyz987</op>
</prod>
</root>
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<prod>
<xsl:apply-templates select="root/prod/op"/>
</prod>
</xsl:template>
<xsl:template match="op">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Gives this:
<?xml version="1.0" encoding="UTF-8"?>
<prod>
<op>abc123</op>
<op>xyz987</op>
</prod>
Hope that helps.
cheers
Malcolm
-----Original Message-----
From: Holmberg Rick-ra0119 [mailto:Rick.Holmberg@motorola.com]
Sent: Tuesday, September 24, 2002 5:07 PM
To: Xsl-List (E-mail)
Subject: [xsl] Newbie final Tag question
Hoping someone can help with this one...
I have a file like
<prod>
<op>abc123</op>
</prod>
<prod>
<op>xyz987</op>
</prod>
I want to parse through this and output
<prod>
<op>abc123</op>
<op>xyz987</op>
</prod>
No matter which way I try, I keep getting a closing </prod> tag where I dont' want one or it processes teh second <prod> twice.
Any help is appreciated.
Thanks!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list