Hello to all,
Please some help with this. I'm newbie to XML, XLS, Xpath, etc.
How can I set correctly the reference in the command "for-each select" to avoid issues with this Top node that has namespace?
I'm trying to get a XLS stylesheet to get some values. The issue is that the Top node has a colon ":" in its name
"doc-master:DOCMASTER1". Searching I've seen that this is named namespaces, where the prefix is doc-master and the
local name is DOCMASTER1.
To begin practice with something simple I'm trying to get values for BicCode and URMs that are children of AMBic.
The XML input is:
<?xml version="1.0" encoding="UTF-8"?>
<doc-master:DOCMASTER1 xmlns="http://www.xyz.com/DOC-MASTER-1" xmlns:doc-master="http://www.xyz.com/DOC-MASTER-1" xmlns:sub-doc="http://www.xyz.com/sub-doc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com/DOC-MASTER-1 DOC-MASTER.xsd">
<DOCHEADER>
<InitialHour>15:22:01</InitialHour>
<Code>RTPPD</Code>
<Release>G5.3</Release>
</DOCHEADER>
<AMBic>
<BicCode>87637-YTIT672-12</BicCode>
<URMs>778-00012</URMs>
</AMBic>
</doc-master:DOCMASTER1>
The XSL code I'm trying is below, but is failing:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="doc-master:DOCMASTER1/AMBic">
<tr>
<td><xsl:value-of select="BicCode" /></td>
<td><xsl:value-of select="URMs" /></td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks in advance for any help