I am trying to help a collegue with some XML transformation. I have barely spent time in the XML-jungle, but being a "geek" I'm not afraid to throw myself into new technology, new to me that is.
So I'm trying to use this XML:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<Envelope>
<Header>
<MessageId>{1071FB4F-6F5F-42D8-92B2-4EF4D50C95F1}</MessageId>
<SourceEndpointUser />
<SourceEndpoint>DM1</SourceEndpoint>
<DestinationEndpoint>DEMO</DestinationEndpoint>
<Action>readSalesInvoice</Action>
<RequestMessageId />
</Header>
<Body>
<SalesInvoice xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/SalesInvoice">
<DocPurpose>Original</DocPurpose>
<SenderId>dm1</SenderId>
<CustInvoiceJour class="entity">
<Backorder>No</Backorder>
<CashDisc>49.45</CashDisc>
<CashDiscCode>5D2%</CashDiscCode>
<CashDiscDate>2009-01-31</CashDiscDate>
<CurrencyCode>NOK</CurrencyCode>
<CustGroup>20</CustGroup>
<XMLDocPurpose>Original</XMLDocPurpose>
<CustInvoiceTrans class="entity">
<CommissAmountCur>157.02</CommissAmountCur>
<CommissAmountMST>157.02</CommissAmountMST>
<CommissCalc>Yes</CommissCalc>
<InventReportDimHistory class="entity">
<InventDimId>1</InventDimId>
<InventTransId>5904</InventTransId>
<InventDim class="entity">
<inventDimId>1</inventDimId>
<RecVersion>1</RecVersion>
</InventDim>
</InventReportDimHistory>
</CustInvoiceTrans>
<TaxTrans class="entity">
<AccountNum>2710</AccountNum>
<CurrencyCode>NOK</CurrencyCode>
<EUROTriangulation>No</EUROTriangulation>
<Voucher>10000122</Voucher>
</TaxTrans>
</CustInvoiceJour>
</SalesInvoice>
</Body>
</Envelope>
and using this XSL as input to a transformation where I want the result to be HTML.
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:n1="http://schemas.microsoft.com/dynamics/2006/02/documents/custinvoiceJour"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output version="1.0" method="html" indent="yes" encoding="UTF-8"
doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
<xsl:template match="/">
<xsl:value-of select="n1:SalesInvoice/SenderId" />
<html>
<head>
<title>Test</title>
</head>
<body bgcolor="#FFFFFF">
test: <xsl:value-of select="n1:SalesInvoice/n1:SenderId" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Unfortunately only the HTML markup gets out, not the "SenderId".
Can anyone please try to explain what the purpose of those namespaces are, and perhaps point out if I am doing something completely stupid here. ;-)
Thanks!