# Parsing multiple XML documents as strings.

- Thread: https://externals.io/message/14008
- Original archive: https://news-web.php.net/php.internals/14008
- Started by Goformusic Support on 2004-12-06T15:25:09+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #14008 — Goformusic Support — 2004-12-06T15:25:09+00:00

URL: https://externals.io/message/14008#14008

Hi,

We worked with Sablotron before but switched over to the libxslt
library on PHP5 to perform XSL transformations. We used the wrapper
code found on http://be.php.net/xsl so that our old xslt_ functions
continued to work.

Now, with Sablotron we used to parse multiple XML documents as strings
and one XSL file from disk. With libxslt it doesn't seem possible
parsing XML documents as strings.

This is the old method which worked fine, using Sablotron:

$args["/list_docu"] = "<content>some xml</content>";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $args, $params);

This node could then be access with XSL:
<xsl:for-each select="document('arg:/list_docu')/content"> 

When I run this code using libxslt/PHP5 and the wrapper I get the error:
Warning: I/O warning : failed to load external entity "arg:/list_docu"

This is because the XML documents must be saved on disk I guess.
Isn't there any way to load the XML documents as strings???

Grtz,

Bart

---

## #14009 — Rasmus Lerdorf — 2004-12-06T16:27:21+00:00

URL: https://externals.io/message/14008#14009 · In reply to: #14008

This isn't an internals question.  Please post such questions to 
php-general.  It's also pretty well documented.  Please see the 
documentation for domxml_open_mem() and domxml_xslt_stylesheet_file()

-Rasmus




> Hi,
> 
> We worked with Sablotron before but switched over to the libxslt
> library on PHP5 to perform XSL transformations. We used the wrapper
> code found on http://be.php.net/xsl so that our old xslt_ functions
> continued to work.
> 
> Now, with Sablotron we used to parse multiple XML documents as strings
> and one XSL file from disk. With libxslt it doesn't seem possible
> parsing XML documents as strings.
> 
> This is the old method which worked fine, using Sablotron:
> 
> $args["/list_docu"] = "<content>some xml</content>";
> $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $args, $params);
> 
> This node could then be access with XSL:
> <xsl:for-each select="document('arg:/list_docu')/content"> 
> 
> When I run this code using libxslt/PHP5 and the wrapper I get the error:
> Warning: I/O warning : failed to load external entity "arg:/list_docu"
> 
> This is because the XML documents must be saved on disk I guess.
> Isn't there any way to load the XML documents as strings???
> 
> Grtz,
> 
> Bart
