Цитата:
|
Сообщение от UnOuter
--------------------------------------------------------------------
XML я беру на стороннем сервере!
|
да какая разница - хоть от Святого Духа
Цитата:
а я хотел бы чтобы вот так
Array
(
[0] => 1234567
)
|
PHP код:
<?php
// $xml and $xsl contain the XML and XSL data
$arguments = array(
'/_xml' => $xml,
'/_xsl' => $xsl
);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($result) {
print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result";
print " variable, the \$result variable has the following contents\n<br>\n";
print "<pre>\n";
print $result;
print "</pre>\n";
}
else {
print "Sorry, sample.xml could not be transformed by sample.xsl into";
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>
( стыбрено с
http://devzone.zend.com/node/view/id/1302#Heading16 )
возьми такой XSL:
PHP код:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="w3s.response/reqn"/>
</xsl:template>
<xsl:template match="w3s.response/reqn">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
и ты на выходе в $result получишь свое 1234567
поверь, это гораздо грамотнее, чем применять к XML регэкспы