html - Getting "prefix 'soap' is not defined" in xslt file -


i trying transform string xml data (response web service). tried start simple getting name:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">     <xsl:output method="html" indent="yes"/>      <xsl:template match="/">       <table>         <tr>           <th>name</th>         </tr>         <xsl:for-each select="soap:envelope/soap:body/abrsearchbyabnresponse/abrpayloadsearchresults/response/legalname/">           <tr>             <td>               <xsl:value-of select="givenname"/>             </td>                 </tr>          </xsl:for-each>        </table>     </xsl:template> </xsl:stylesheet> 

however, "prefix 'soap' not defined", how fix this? thanks.

in xslt namespace prefix used in xpath expression must defined in corresponding namespace declaration.

this not case code , hence error.

solution:

declare soap namespace:

<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/xsl/transform"       xmlns:msxsl="urn:schemas-microsoft-com:xslt"   xmlns:soap="http://soap/envelope/" > 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -