
Hi, I need to create an array of elements with several attributes: <a name="aa" dt:dt="string">aValue</a> dt is a namespace " "htttp://www.dt.com" By using xslt: <custom-attributes> <xsl:for-each select="$custom-attributes"> <xsl:variable name="markCode" select="string(lower-case(./@MarkCode))"/> <xsl:variable name="dtType">string</xsl:variable> <xsl:variable name="markCodeValue" select="./@MarkValue"/> <xsl:element name="custom-attribute" inherit-namespaces="no"> <xsl:attribute name="name" select="$markCode"/> <xsl:attribute name="dt" select="$dtType/text()"/> <xsl:value-of select="$markCodeValue/text()"/> </xsl:element> </xsl:for-each> </custom-attributes> I get in the result <custom-attribute xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt" name="brand" dt:dt="string">TITANFLX</custom-attribute> I need to get the xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt" out of the attribute, The result should be: <custom-attribute name="brand" dt:dt="string">TITANFLX</custom-attribute> Yours, Martijn

Dear Martijn, I do not understand how you get that output from the XSLT fragment from your post. As you wrote the XSLT code you should not get a different namespace for the dt attribute. What you wrote as expected result is not namespace wellformed (the dt prefix is not declared) and you will not be able to get that as output from an XSLT that outputs XML. If you want <custom-attribute xmlns:dt="htttp://www.dt.com" name="brand" dt:dt="string">TITANFLX</custom-attribute> then you just need to make sure you declare the namespace also in your stylesheet and use dt:dt as attribute name instead of dt in your XSLT code. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 5/25/10 12:01 PM, Martijn Van der Graaff wrote:
Hi,
I need to create an array of elements with several attributes:
<a name="aa" dt:dt="string">aValue</a>
dt is a namespace " "htttp://www.dt.com"
By using xslt:
<custom-attributes> <xsl:for-each select="$custom-attributes"> <xsl:variable name="markCode" select="string(lower-case(./@MarkCode))"/> <xsl:variable name="dtType">string</xsl:variable> <xsl:variable name="markCodeValue" select="./@MarkValue"/> <xsl:element name="custom-attribute" inherit-namespaces="no"> <xsl:attribute name="name" select="$markCode"/> <xsl:attribute name="dt" select="$dtType/text()"/> <xsl:value-of select="$markCodeValue/text()"/> </xsl:element> </xsl:for-each> </custom-attributes>
I get in the result
<custom-attribute xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt" name="brand" dt:dt="string">TITANFLX</custom-attribute>
I need to get the xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt" out of the attribute, The result should be:<custom-attribute name="brand" dt:dt="string">TITANFLX</custom-attribute>
Yours, Martijn _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
George Cristian Bina
-
Martijn Van der Graaff