xsl-list
[Top] [All Lists]

Problem caused by Name space

2002-10-21 09:02:49
Hi,

I have a SOAP document that is being returned back to me that I want to use XSLT to format for display on my web page. I am getting the SOAP content from a 3rd party and don't have control over it. Here is a snippet of the SOAP xml:

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope";>
 <soap:body>
  <eraRequest xmlns="http://www.somewhere.com/era";>
    <uri>data</uri>
    <parameters>
      <data>4</data>
    </parameters>
  </eraRequest>
 </soap:body>
</soap:envelope>

I am using this:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:template match="/">
root
 <xsl:apply-templates select="//parameters"/>
</xsl:template>
<xsl:template match="parameters">
parameters
  <xsl:apply-templates select="//data"/>
</xsl:template>
<xsl:template match="data">
  data: <xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>

Here are my questions:

1st) The XSLT never finds anything below root. If I specify a prefix in the eraRequest xmlns section then everything works correctly. Is there a way to write the XSLT so that it doesn't need the prefix to local the <data>?

2nd) is the statement <eraRequest xmlns="http://www.somewhere.com/era";> in the xml legal? do you not have to put a prefix with the name space?


--
-----------------------------------------------
Jeff Nester
Sun Microsystems - Sun ONE Software Division

work:     (888) 733-0328
internal: x68268
email:    jeff(_dot_)nester(_at_)sun(_dot_)com
-----------------------------------------------



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>