"BENHAJ-ABDELLATIF,TAHIA (HP-France,ex1)" <[EMAIL PROTECTED]> writes:

> Of course, it exists a way, for an xml document to define its xslt file.
> 
> <?xml-stylesheet type="text/xsl" href="/home/user/myFile.xslt"?>
> <element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="/home/taben/BeforeLiving/mySchema.xsd">
> Here, the xslt file that will be used to transform my xml file is:
> "/home/user/myFile.xslt".

If this is the convention that you will use, then you can use DOM and
look for a processing instruction node. If it will always be the first
tag after the xml declaration you can simply get the first child of
the document.

  $stylesheet = $parser->getDocument->getFirstChild();

But that seems problematic. I would suggest using a node iterator or a
tree walker, and setting the node filter for processing
instructions. See the examples in the t/ directory for how to use
those:

t/DOMNodeIterator.t
t/DOMTreeWalker.t

hope this helps,
jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to