• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

xml and stylesheet

Hi, I am new to xml and stylesheets, I have the attached xml Invoice file that I am trying to match up with the attached stylesheet.  The stylesheet is using the <xsl:choose> to determine if the Invoice file is a Credit note or an Invoice.  It keeps returning the Credit Note option when in fact it should be an invoice.  Any ideas on how I have gone wrong?
CBS.xsl
JK2006024.xml
0
sochionnaitj
Asked:
sochionnaitj
  • 3
1 Solution
 
Geert BormansCommented:
You have the namespaces wrong all through your stylesheet

make the choose like this
            <xsl:when test="/abw:ABWInvoice/abw:Invoice/abw:Header/abw:InvoiceType/@Code='INV'">Invoice</xsl:when>

and add the namespace to the stylesheet element

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version='1.0'  
  xmlns:HB='urn:schemas-basda-org:2001:eBUILD:1.00'
  xmlns:si='urn:schemas-basda-org:2000:salesInvoice:xdr:3.01'
  xmlns:abw="http://services.agresso.com/schema/ABWInvoice/2006/11/20"
  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

but you then need to replace si: with abw: all through the stylesheet

or alternatively replcae the binding for si:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version='1.0'  
  xmlns:HB='urn:schemas-basda-org:2001:eBUILD:1.00'
  xmlns:si="http://services.agresso.com/schema/ABWInvoice/2006/11/20"
  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

and leave the rest as is
0
 
Geert BormansCommented:
mmh, I would take the second approach
(altered stylesheet attached)
CBS.xsl
0
 
sochionnaitjAuthor Commented:
Thanks Gertone for your prompt and excellent answer
0
 
Geert BormansCommented:
welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now