cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping and Namespace Issues

Former Member
0 Kudos

I have been reading through similar threads on this topic, but have not found the right combination for my problem. I am doing an XSLT map and it works fine in Stylus Studio. When I take it to PI, I get a "Prefix 'ns0' is not mapped to a namespace" error. I have a namespace that is within the XSD files I received from my partner (http://www.ups.com/XMLSchema/EBR/Billing/v1). I also have the namespace I made in PI for the source (http://graybar.com/upsbilling/) and a different namespace in PI for the destination (http://graybar.com/cold/invoice/).

<u><b>XSLT:</b></u>

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.ups.com/XMLSchema/EBR/Billing/v1" xmlns:ns1="http://graybar.com/cold/invoice/">

<xsl:template match="/">

<ns1:ColdInvoiceData>

<Header>

<RecordID>HDR</RecordID>

<InvoiceDate>

<xsl:value-of select="ns0:UPS_EBR_BILL/ns0:InvoiceDetails/ns0:Invoice/ns0:InvoiceDateCCYYMMDD"/>

</InvoiceDate>

...

<u><b>Source XML</b></u>

<?xml version="1.0" encoding="ISO-8859-1" ?>

<UPS_EBR_BILL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ups.com/XMLSchema/EBR/Billing/v1" xsi:schemaLocation="http://www.ups.com/XMLSchema/EBR/Billing/v1 Billing_XML_Schema.xsd">

<XMLBillFileVersion>1.0.1</XMLBillFileVersion>

<Recipient>

...

When I change the XSLT namespace from http://www.ups.com/XMLSchema/EBR/Billing/v1 to http://graybar.com/upsbilling/, the TransfromerException in PI goes away, but none of my referenced mappings work either (just my text hardcodes).

Can someone tell me why this works in Stylus Studio, but not in PI? Do I have too many namespaces?

Message was edited by:

Keith Wendel (to uncomment xsl:stylesheet line)

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Would this work:

...
<ns1:ColdInvoiceData xmlns:ns1="http://graybar.com/cold/invoice/">
<Header>
<RecordID>HDR</RecordID>
<InvoiceDate>
<xsl:value-of select="ns0:UPS_EBR_BILL/ns0:InvoiceDetails/ns0:Invoice/ns0:InvoiceDateCCYYMMDD"/>
</InvoiceDate>
...

Former Member
0 Kudos

keith,

looks silly answer, but let me know if this helps

in the code u had pasted your 2nd line after the XML tag which is ur XSL:STYLESHEET tag is commented

udo_martens
Active Contributor
0 Kudos

Hi,

silly? No, if you comment the namespace declaration, prefix cant be find.

Regards,

Udo

Former Member
0 Kudos

true but he mentioned it worked in stylus

Former Member
0 Kudos

> <ns1:ColdInvoiceData xmlns:ns1="http://graybar.com/cold/invoice/">

This change did not affect anything. Still works in Stylus Studio though.

Did you mean to show any changes at the <xsl:value-of select> line? I did not notice anything there.

Can anyone explain what "not mapped to a namespace" means? I have the declaration of ns0 at the top, so I don't see what else needs to be mapped. Do I have to have my PI namespace where I store the partner's XSDs set as "http://www.ups.com/XMLSchema..." (partner's namespace)?

Answers (2)

Answers (2)

Former Member
0 Kudos

I am not sure change along the way helped, but now when I run a test in IB-Rep with real source data pasted in, the xslt mapping works. It still gives the ns0 error if I just test with the default structure.

The other day, both were failing. My xsl is the same as above. Thanks everyone.

Former Member
0 Kudos

Ignore the beginning comment mark. That was a copy/paste issue. I will go edit it. I have yet to try Stefan's recommendation.