Is it possible to skip nodes when processing an xml file. for example i have the following xml code
<mycase desc="">
<caseid> id_1234 </caseid>
<serid ref=""/>
......
......
......
</mycase>
and I want it to look like
<mycase desc="" caseid="id_1234">
.....
.....
</mycase>
I'm currently doing this
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="xs xdt err fn"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:err="http://www.w3.org/2005/xqt-errors">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="mycase">
<xsl:element name="mycase">
<xsl:attribute name="desc"/>
<xsl:attribute name="caseid">
<xsl:value-of select="caseid"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
......
......
This creates what I want, but because
<xsl:apply-template/>
handles all the node. while I want it to skip caseid and serid processing all together. This also applies to other nodes that will not be available in the new XML structure. So, how can I skip nodes that I don’t want to process with xslt.
Regards, Ehsan
Goozo source
share