Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak wyswietlic xml za pomoca php ?
qwere
post 15.06.2005, 10:17:35
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 5.04.2005

Ostrzeżenie: (0%)
-----


witam

mam 2 problemy :

Czy jest mozliwe podmienienie w pliku xml linku href="all.xsl"
oczywiscie za pomoca php

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <?xml-stylesheet type="text/xsl" href="all.xsl"?>


na jakis inny ...chodzi o to zeby do jednego xmla było kilka xsl'ów


to raz a 2

znalazłem w manualu 3 rozne sposoby wyświetlania xmla tyle ze zaden mi nie działa sad.gif

  1. <?php
  2.  
  3. $xmldata = &#092;"all.xml\";
  4. $xsl = &#092;"all.xsl\";
  5.  
  6. function xml2html($xmldata, $xsl)
  7. {
  8.  /* $xmldata -> your XML */
  9.  /* $xsl -> XSLT file */  
  10.  
  11.  $path = 'include';
  12.  $arguments = array('/_xml' => $xmldata);
  13.  $xsltproc = xslt_create();
  14.  xslt_set_encoding($xsltproc, 'ISO-8859-1');
  15.  $html = xslt_process($xsltproc, 'arg:/_xml', &#092;"$path/$xsl\", NULL, $arguments);
  16.  
  17.  if (empty($html))
  18.  
  19. {
  20.  die('XSLT processing error: '. xslt_error($xsltproc));
  21.  }
  22.  
  23.  xslt_free($xsltproc);
  24.  return $html;
  25.  echo $html;
  26. }
  27.  
  28. ?>


ta funkcja wyplówa nic exclamation.gif!


  1. <?php
  2.  
  3. $xsl = new DomDocument();
  4. $xsl->load(&#092;"all.xsl\");
  5. $inputdom = new DomDocument();
  6. $inputdom->load(&#092;"all.xml\");
  7. $proc = new XsltProcessor();
  8. $proc->registerPhpFunctions();
  9. $xsl = $proc->importStylesheet($xsl);
  10. $newdom = $proc->transformToDoc($inputdom);
  11. $sxe = simplexml_import_dom($newdom);
  12. print('<pre>');
  13. print_r($sxe->dict);
  14. print('</pre>');
  15. ?>


a ta
  1. Fatal error: Cannot instantiate non-existent class: domdocument in c:\www\[korporacje]\stare xml\pro2.php on line 49


i znalazłem jeszcze cos takiego

  1. <?php
  2.  
  3. $xslt = new xsltTransform(&#092;"all.xsl\", \"all.xml\");
  4. print ($xslt->applyTransformation());
  5.  
  6. ?>



Ale tez nic blink.gif

Ma ktos jakies pomysły questionmark.gifmellow.gif

Ten post edytował qwere 15.06.2005, 10:21:24
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 06:30