No doubt a quick one for you experts, but for me it has been a fruitless afternoon.
I have XML that I have been asked to interrogate a bit further (cut down version below...)
What I want to do is output the various parts and represent in html. All I need to add is the env:destination/@branch.
But I can't seem to get at it.
="1.0"="utf-8"
<kmsg xmlns:env="http://xml.kerridgecs.net/K809/k8msgEnvelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xml.kerridgecs.net/k8msg" xsi:schemaLocation="http://xml.kerridgecs.net/k8msg K8Invoice.xsd">
<header>
<env:envelope>
<env:source branch="DEFAULT" endpoint="suppNum" machine="0" password="Toast" />
<env:destination branch="0009" endpoint="01" machine="0" />
<env:payload>INVOICE</env:payload>
<env:cfcompany>01</env:cfcompany>
<env:service>NOTSET</env:service>
</env:envelope>
</header>
<body>
<Invoice xmlns="urn:schemas-basda-org:2000:salesInvoice:xdr:3.01">
<InvoiceReferences>
<BuyersOrderNumber>1003164</BuyersOrderNumber>
</InvoiceReferences>
</Invoice>
</body>
</kmsg>
I have taken a copy of the current stylesheet that is working, (I may have missed a couple of nodes during tidying up to ask this question, apologies)
="1.0"="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:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:env="http://xml.kerridgecs.net/K809/k8msgEnvelope">
<xsl:output encoding='iso-8859-1' method='html' />
<xsl:variable name="document-version">
Testing
</xsl:variable>
<xsl:template match='/'>
<html>
<head>
<title><xsl:copy-of select="$document-version" /></title>
</head>
<body>
<table width='100%'>
<tr>
<td style='font-family:verdana;font-size:10pt;color:navy;text-align:right;font-weight:bold'>
DESTINATION BRANCH<br><font size='5'>I WANT THE BRANCH NUMBER TO APPEAR HERE</font></br>
</td>
</tr>
<tr style='height:10'>
<td></td>
<td></td>
</tr>
</table>
<xsl:apply-templates select='//si:Invoice' />
</body>
</html>
</xsl:template>
<xsl:template match='si:Invoice'>
<table>
<tr>
<td>
<table>
<tr>
<td>
<xsl:value-of select='si:InvoiceReferences/si:BuyersOrderNumber' />
<xsl:if test='not(string-length(si:InvoiceReferences/si:BuyersOrderNumber))'>
<div class='warn'>Missing essential data.</div>
</xsl:if>
</td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
What I have tried:
I have tried a few combinations, I have looked for namespace, (I suspect this would be the answer...), added
xmlns:env="http://xml.kerridgecs.net/K809/k8msgEnvelope"
then tried
<xsl:value-of select='env:destination/@branch' />
or
<xsl:value-of select='env:envelope/env:destination/@branch' />
I have tried going to the full path...
<xsl:value-of select='/kmsg/header/env:envelope/env:destination/@branch' />
Obviously I am missing something. All help appreciated and thanks in advance.