0

I'm trying to avoid (in order to create a new HTML file) the namespace from my input file . My xslt file looks as the follow:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 exclude-result-prefixes="import_lc_iss">
<xsl:template match="/">
  <html>
  <body>
    <h2>Recieved Message </h2>
    <table border="1">
       <tr >
        <th>Entity</th>
        <th>Reference Number</th>
        <th>Transaction Date</th>
      </tr>
        <tr>
           <td><xsl:value-of select="/header/entity"/></td>
           <td><xsl:value-of select="/header/reference_no"/></td>
           <td><xsl:value-of select="/header/transaction_date"/></td>
        </tr>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

my xml input looks as the following:

  <?xml version="1.0" encoding="UTF-8"?>
    <import_lc_iss xmlns="interface.nicom.allnett">
    <header direction="Outgoing" send_date="2015-09-10T19:25:24+03:00">
    <entity>001</entity>
    <customer id="11111111-1"/>
    <deal_no/>
    <identity deal_type="01" step="ISS" step_no="0"/>
    <reference_no>LCI00000000042</reference_no>
    <transaction_date>2015-09-10T19:25:14+03:00</transaction_date>
    </header>
    </import_lc_iss> 

In order to retrieve what's inside the entity tag. i'm trying to skip the nsame space. i tried adding to the style sheet

exclude-result-prefixes="import_lc_iss"

but it didn't work. is there any idea how to get the values?

Thanks in advance

Nir
  • 1,524
  • 6
  • 23
  • 41
  • Possible duplicate of http://stackoverflow.com/questions/857010/xsl-avoid-exporting-namespace-defintions-to-resulting-xml-documents – vanje Nov 17 '15 at 13:52

1 Answers1

1

Namespaces are to be used, not avoided. And exclude-result-prefixes does not work that way. Try:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="interface.nicom.allnett"
exclude-result-prefixes="ns1">

<xsl:template match="/ns1:import_lc_iss">
  <html>
  <body>
    <h2>Recieved Message </h2>
    <table border="1">
       <tr >
        <th>Entity</th>
        <th>Reference Number</th>
        <th>Transaction Date</th>
      </tr>
        <tr>
           <td><xsl:value-of select="ns1:header/ns1:entity"/></td>
           <td><xsl:value-of select="ns1:header/ns1:reference_no"/></td>
           <td><xsl:value-of select="ns1:header/ns1:transaction_date"/></td>
        </tr>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>
michael.hor257k
  • 113,275
  • 6
  • 33
  • 51