I am on xlst 1.0,
This is my stylesheet,
<xsl:template match="/Request">
<data>
<Elem n="{name(.)}">
<xsl:for-each select="@*">
<xsl:if test="name(.)='System'">
<attr n="{name(.)}">
<xsl:element name="val">
<xsl:attribute name="s">
<xsl:value-of select="normalize-space(.)"/>
</xsl:attribute>
</xsl:element>
</attr>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates/>
</Elem>
</data>
</xsl:template>
I only want to get the "System" attribute and ignore all the rest.
The stylesheet works perfectly fine and generate following output-1
when I use input-1 and input-2 as below.
input-1:
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="abc.xsd" System="mysystem">
</Request>
input-2:
<?xml version="1.0" encoding="UTF-8"?>
<Request abc="myabc" System="mysystem">
</Request>
output-1:
<?xml version="1.0" encoding="utf-8"?>
<data>
<Elem n="Request">
<attr n="System">
<val s="mysystem"/>
</attr>
</Elem>
</data>
THE PROBLEM arise when the input is with xmlns without prefix "xsi",
the output that is output-3 as below:
input-3: Remove the xsi prefix from xmlns
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.abc.com" System="mysystem">
</Request>
output-3:
<?xml version="1.0" encoding="utf-8"?>
I have no idea why "xmlns" is causing problem here?
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--