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

1

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.