S
Sammy
Hi, my mind is going crazy. I have tried everything I can think of to
no
avail.
I have tried Disable Output Escaping.
I tried to think of a way of enclosing the attribute data in a CDATA
element. That did not parse.
Here is my question:
How can I get attribute values to not get converted from ' to '
or & to & or < to > ?
It seems like if I take the xsl:value-of an attribute and then output
that
value into another xml it get's converted.
The problem is I am importing this stuff into a DB and I need to keep
all
those ' and other escapings..
Also, is there a way to do something like this
<![CDATA[
<xsl:value-of select="@CATEGORY" />
]]>
The problem with this is it gives me
<xsl:value-of select="@CATEGORY" />
where I want
Men's Clothing
Thanks any help would be appreciated...
Here is my source xml, XSL, and outfile:
Source XML:
<import>
<CAT>
<row CATEGORY="Men's Clothing" />
</CAT>
</import>
XSL:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput indent="yes" method="xml" />
<xsl:strip-space elements="*"/>
<xsl:template name="frank_data">
<xslaram name="id" />
<xsl:element name="frankgroup">
<xsl:attribute name="identifier"><xsl:value-of select="$id"
/></xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="/">
<xsl:element name="import">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="CAT">
<xsl:for-each select="*">
<xsl:call-template name="frank_data">
<xsl:with-param name="id" select="@CATEGORY" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Output:
<import>
<frankgroup
id="Men's Clothing" />
</import>
no
avail.
I have tried Disable Output Escaping.
I tried to think of a way of enclosing the attribute data in a CDATA
element. That did not parse.
Here is my question:
How can I get attribute values to not get converted from ' to '
or & to & or < to > ?
It seems like if I take the xsl:value-of an attribute and then output
that
value into another xml it get's converted.
The problem is I am importing this stuff into a DB and I need to keep
all
those ' and other escapings..
Also, is there a way to do something like this
<![CDATA[
<xsl:value-of select="@CATEGORY" />
]]>
The problem with this is it gives me
<xsl:value-of select="@CATEGORY" />
where I want
Men's Clothing
Thanks any help would be appreciated...
Here is my source xml, XSL, and outfile:
Source XML:
<import>
<CAT>
<row CATEGORY="Men's Clothing" />
</CAT>
</import>
XSL:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput indent="yes" method="xml" />
<xsl:strip-space elements="*"/>
<xsl:template name="frank_data">
<xslaram name="id" />
<xsl:element name="frankgroup">
<xsl:attribute name="identifier"><xsl:value-of select="$id"
/></xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="/">
<xsl:element name="import">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="CAT">
<xsl:for-each select="*">
<xsl:call-template name="frank_data">
<xsl:with-param name="id" select="@CATEGORY" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Output:
<import>
<frankgroup
id="Men's Clothing" />
</import>