[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Inserting XML into stylesheet using copy-of


Subject: Re: [xsl] Inserting XML into stylesheet using copy-of
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Wed, 27 Jan 2010 10:32:10 +0100

For me this works, you may want to check your URL:

[html]$ cat s1h.xsl
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <xsl:copy-of select="document('http://127.0.0.1/s1.xml')/here"/>
</xsl:template>

</xsl:stylesheet>
[html]$ xsltproc s1h.xsl some.xml
<?xml version="1.0"?>
<here>hello</here>
[html]$

And accessing that stylesheet from within a browser
(http://127.0.0.1/s2.xml) works too:
[html]$ cat s2.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://127.0.0.1/s1h.xsl"?>
<xml/>
[html]$



Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


                                                                           
             Rob Belics                                                    
             <rob_belics@chart                                             
             er.net>                                                    To 
                                       xsl-list@xxxxxxxxxxxxxxxxxxxxxx     
             01/27/2010 04:48                                           cc 
             AM                                                            
                                                                   Subject 
                                       [xsl] Inserting XML into stylesheet 
             Please respond to         using copy-of                       
             xsl-list@xxxxxxxx                                             
              lberrytech.com                                               
                                                                           
                                                                           
                                                                           
                                                                           




When I use a local file, I can insert an XML file into my xslt
stylesheet doing this:
<xsl:copy-of select="document('s1.xml')"/>

So I put s1.xml on my personal site:
<xsl:copy-of select="document('http://mysite.com/xml/s1.xml')"/>
but it fails with "XML Parsing Error: no element found"

s1.xml only contains <here>hello</here> and I can access it via a
browser. What am I doing wrong?


Current Thread
Keywords