Subject: Re: [xsl] How do I remove an attribute from a file? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 28 May 2004 16:07:39 -0400 |
I have an xml file that contains a tag called <bit>. <bit> has two attribute: type and status, so it often looks like this:
<bit type="a" status="b">bitinfo</bit>
I want to remove all status attributes when they appear (they are optional), so that the result will look like this:
<bit type="a">bitinfo</bit>
Can anyone help me?
T:\ftemp>type jon.xml <?xml version="1.0" encoding="iso-8859-1"?> <bits> <bit type="a" status="b">bitinfo</bit> <bit type="b" status="c">bitinfo</bit> <bit type="d">bitinfo</bit> <bit status="e">bitinfo</bit> <bit type="f" status="g">bitinfo</bit> </bits> T:\ftemp>type jon.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
</xsl:stylesheet> T:\ftemp>saxon jon.xml jon.xsl <?xml version="1.0" encoding="utf-8"?><bits> <bit type="a">bitinfo</bit> <bit type="b">bitinfo</bit> <bit type="d">bitinfo</bit> <bit>bitinfo</bit> <bit type="f">bitinfo</bit> </bits> T:\ftemp>
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004
World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How do I remove an attrib, Josh Canfield | Thread | [xsl] Doctype and namespaces in sou, Mayo |
RE: [xsl] How do I remove an attrib, Josh Canfield | Date | Re: [xsl] Problems with tables and , J.Pietschmann |
Month |