G
gooooglegroups
I want to transform the following xml file
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="if 3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
into this xml file
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
i.e. I want to remove the "if" character from the start of the value of
the attribute "attrib"
I am using the style sheet...
------------------------------------------------------------------------
<?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( ) | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node( )"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@attrib[starts-with(., 'if ')]">
<xsl:attribute name="attrib">
<xsl:value-of select="substring-after(., 'if ')"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------
with "Xalan Version Xalan Java 2.4.1", but I get the following output
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
where the greater-than character is changed to > .
I need to have the single > character in the output also.
Is there any way in XSLT of keeping the greater-than and less-than
characters > and < in attribute values when you transform instead of
having > and < ?
If there is no way to achieve this in XSLT, what would be the
recommended method for achieving this?
Any help\pointers greatly appreciated,
Regards,
Metric
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="if 3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
into this xml file
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
i.e. I want to remove the "if" character from the start of the value of
the attribute "attrib"
I am using the style sheet...
------------------------------------------------------------------------
<?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( ) | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node( )"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@attrib[starts-with(., 'if ')]">
<xsl:attribute name="attrib">
<xsl:value-of select="substring-after(., 'if ')"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------
with "Xalan Version Xalan Java 2.4.1", but I get the following output
------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
<b attrib="3 > 2">
</b>
<b attrib="3 > 1">
</b>
</a>
------------------------------------------------------------------------
where the greater-than character is changed to > .
I need to have the single > character in the output also.
Is there any way in XSLT of keeping the greater-than and less-than
characters > and < in attribute values when you transform instead of
having > and < ?
If there is no way to achieve this in XSLT, what would be the
recommended method for achieving this?
Any help\pointers greatly appreciated,
Regards,
Metric