I
ina
Hello all,
I am newbie in xml and have a problem with this parse.
I have this xml.file
<Style>
<Strategy>
<Style_Strategy>Geo\Asia</Style_Strategy>
<Style_Strategy>Geo\America</Style_Strategy>
<Style_Strategy>Geo\Europe</Universe>
<Style_Strategy>Sector\America\Cash</Style_Strategy>
</Strategy>
</Style>
and
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="Style/Strategy/Style_Strategy">
<xsl:variable name="new_tag_name"
select="substring-after(.,'Geo\')"/>
<xsl:element name="{$new_tag_name}">
<xsl:value-of select="$new_tag_name"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I would like to have this as output
<Style>
<Strategy>
<Asia>Asia</Asia>
<America>America</America>
<Europe>Europe</Europe>
<Style_Strategy>Sector\America\Cash</Style_Strategy>
</Strategy>
</Style>
But I have this error: xsl:element must have a value for name
attribute? why?
Ina
I am newbie in xml and have a problem with this parse.
I have this xml.file
<Style>
<Strategy>
<Style_Strategy>Geo\Asia</Style_Strategy>
<Style_Strategy>Geo\America</Style_Strategy>
<Style_Strategy>Geo\Europe</Universe>
<Style_Strategy>Sector\America\Cash</Style_Strategy>
</Strategy>
</Style>
and
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="Style/Strategy/Style_Strategy">
<xsl:variable name="new_tag_name"
select="substring-after(.,'Geo\')"/>
<xsl:element name="{$new_tag_name}">
<xsl:value-of select="$new_tag_name"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I would like to have this as output
<Style>
<Strategy>
<Asia>Asia</Asia>
<America>America</America>
<Europe>Europe</Europe>
<Style_Strategy>Sector\America\Cash</Style_Strategy>
</Strategy>
</Style>
But I have this error: xsl:element must have a value for name
attribute? why?
Ina