Skip to Content
avatar image
Former Member

XSL works in XML spy but not in PI

Hello,

Can any body help me with this.

This code works fine in xml spy.. It does change the prefix ns0 and ns1 to core and info.

The problem is that i does not work i PI becaue of line

<xsl:element name="info:{local-name()}">. The error is related to somthing like Qname. and i get following

error message

Namespace for prefix 'info' has not been declared. ??????

I hope you can help.

Thanks

<?xml version="1.0" encoding="UTF-8"?>

Namespaces.Stralfors.com:Cmf:CoreTypes:0001" xmlns:ns0="urn: Namespaces.Stralfors.Com:Cmf:InfoModel:OrderManagement:CmfGcaSalesOrder:0001" xmlns:core="urn: Namespaces.Stralfors.com:Cmf:CoreTypes:0001" xmlns:info="urn: Namespaces.Stralfors.Com:Cmf:InfoModel:OrderManagement:CmfGcaSalesOrder:0001" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">

<xsl:template match="ns0:*">

<xsl:element name="info:{local-name(*)}">

<xsl:copy-of select="/@"/>

<xsl:apply-templates select="*/node()"/>

</xsl:element>

</xsl:template>

<xsl:template match="ns0:*">

<xsl:element name="info:{local-name()}">

<xsl:copy-of select="@*"/>

<xsl:apply-templates/>

</xsl:element>

</xsl:template>

<xsl:template match="ns1:*">

<xsl:element name="core:{local-name(*)}">

<xsl:copy-of select="/@"/>

<xsl:apply-templates select="*/node()"/>

</xsl:element>

</xsl:template>

<xsl:template match="ns1:*">

<xsl:element name="{local-name()}">

<xsl:copy-of select="@*"/>

<xsl:apply-templates/>

</xsl:element>

</xsl:template>

</xsl:stylesheet>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 29, 2010 at 02:42 PM

    > The problem is that i does not work i PI becaue of line

    > <xsl:element name="info:{local-name()}">.

    Is this XSLT 2.0? PI supports only XSLT 1.0

    Add comment
    10|10000 characters needed characters exceeded