xsl-list
[Top] [All Lists]

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

2010-01-27 06:58:28
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(_at_)chart                                           
  
             er.net>                                                    To 
                                       
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com     
             01/27/2010 04:48                                           cc 
             AM                                                            
                                                                   Subject 
                                       [xsl] Inserting XML into stylesheet 
             Please respond to         using copy-of                       
             xsl-list(_at_)lists(_dot_)mu                                     
        
              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?


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--