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

Subject: Re: [xsl] Inserting XML into stylesheet using copy-of
From: Rob Belics <rob_belics@xxxxxxxxxxx>
Date: Wed, 27 Jan 2010 06:57:08 -0600
On Wed, 2010-01-27 at 10:32 +0100, Hermann Stamm-Wilbrandt wrote:
> 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?
> 

After a night's sleep, I noticed I didn't use
"document('http://mysite.com/xml/s1.xml')/here" with '/here' on the end
though I know I did at one time. I do not get the error now but the page
does not show the enclosed text and I don't see it in DOM Inspector on
Firefox. Perhaps it wouldn't? Don't know. Better tool for that?

Could it be I need to look at my transform of the inserted xml to make
sure something's done with that?

Current Thread