[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

document() passed as argument with Sablotron

Subject: document() passed as argument with Sablotron
From: "William S." <wstan@xxxxxxxxx>
Date: Fri, 14 Feb 2003 23:03:57 +0100
sablotron arguments
I am trying to get document() to work when the
content of an xml file is passed as an argument
using Sablotron. My goal is to apply this method
to bringing in several xml files to the stylesheet.
Below is the test situation. Can anyone see where
I am going wrong?

--- begin doc_test.php ---
<?php 
$xsl = "./doc_test.xsl";
$mydata = "./doc_test.xml";
$arguments = array();
$arguments['mydata'] = $mydata;
ob_start();

$_parser = xslt_create(); 

if( !$result = @xslt_process(  $_parser,    // resource xh
                               $xml,        // string xsl
			       $xsl,
			       NULL,
			       $arguments,
			       array()
                             ) ) {
    printf( "Sablotron Error (%s): <br /><strong>%s</strong>", 
            xslt_errno($_parser), xslt_error($_parser) );
}
ob_end_clean();
xslt_free($_parser);
echo $result;
?>
--- end doc_test.php ---
--- begin doc_test.xml ---
<?xml version="1.0" ?>
<foo>
<bar>one</bar>
<bar>two</bar>
<bar>three</bar>
</foo>
--- end doc_test.xml ---
--- begin doc_test.xsl ---
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html><body>
<xsl:apply-templates select="document('arg:/mydata')" />
<xsl:apply-templates />
</body></html>
</xsl:template>

<xsl:template match="foo">
   <table>
     <tr>
       <xsl:for-each select="bar">
         <td><xsl:value-of select="." /></td>
       </xsl:for-each>
     </tr>
   </table>
</xsl:template>

</xsl:stylesheet>
--- end doc_test.xsl ---
-- 
Bill
Amsterdam, NL

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.