You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joern Gersdorf <jo...@gmx.de> on 2000/09/29 21:47:22 UTC

Problem with document(...,...)

Hi there,

I have a problem using the document(...,...)-function. 

I try to process an external .xml-File in a stylesheet. The stylesheet
should process the nodes of the external stylesheet. 

I have a stylesheet test.xsl. This stylesheet processes a xml-source called
test.xml and additionally a file reiter.xml (see below).

This is my code:

---- <test.xsl> ----
<xsl:template match="estars:reiterleisten">
  <xsl:for-each select="estars:reiter">
      <xsl:choose>
         <xsl:when test="@path='/settlements'">
	     <xsl:apply-templates select="document('reiter.xml','')"/>
	 </xsl:when>
      </xsl:choose>
  </xsl:for-each>
</xsl:template>

<xsl:template match="estars:reiterdefinition">
  <p> ddd<xsl:value-of select="."/> </p>
</xsl:template>
--- </test.xml> ----

---- <reiter.xml> ----
<?xml version="1.0" encoding="iso-8859-1"?>

<estars:reiterdefinition path="/settlements">
TEST Settlements IMPORTED.
</estars:reiterdefinition>
---- </reiter.xml> ----

This is what happens: 

* when using <xsl:apply-templates select="document('reiter.xml','')"/> my
  output is just:
  
    TEST Settlements IMPORTED.
  
  and not - as expected
  
    <p> dddTEST Settlements IMPORTED. </p>

* but when using <xsl:copy-of select="document('reiter.xml','')"/> my
  output is:
  
    <estars:reiterdefinition path="/settlements">
      TEST Settlements IMPORTED.
    </estars:reiterdefinition>
    

Re: Problem with document(...,...)

Posted by Joern Gersdorf <jo...@gmx.de>.
Okay - first think, then mail - I've found my bug. I forgot to define the
namespace in reiter.xml like this:
 
  <estars:reiterdefinition path="/settlements"
  xmlns:estars="http://estars.dresdner-bank.com/">


bye
joern

--
Joern Gersdorf                          joern.gersdorf@gmx.de
ICQ: 39384677                           gersdorf@cs.uni-frankfurt.de