XSLTProcessor help
| From: | Tom Sparks | Date: | Mon, 16 Feb 2009 10:49:23 +0000 |
| Subject: | XSLTProcessor help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-288310@lists.php.net to get a copy of this message | ||
help, when I include <xsl:apply-templates/>
the XSLTProcessor only strips the XML tags and outputs the text see result
--------------cut here result--------------
<html>
<head><meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"></head>
<body><pre>
Hyalearl, 100-ton Sulieman-Class Scout/Courier
2008
03
10
All rights reserved 2008
Onno Meyer
none@none.com
10
Traveller
1.0
</pre></body>
</html>
-------------cut here------------------
------------cut here vehicle.php----------
<?php
$xslDoc = new DOMDocument();
$xslDoc->load("vehicle.xsl");
$xmlDoc = new DOMDocument();
$xmlDoc->load("vehicle.xml");
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
echo $proc->transformToXML($xmlDoc);
?>
--------------cut here---------------------
--------------cut here vehicle.xsl---------
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<pre>
<xsl:apply-templates/>
</pre>
</body>
</html>
</xsl:template>
<xsl:template match="meta">
<!-- meta -->
</xsl:template>
</xsl:stylesheet>
--------------cut here---------------------
--------------cut here vehicle.xml---------
<?xml version="1.0" encoding="UTF-8" ?>
<vehicle id="1" xmlns="http://localhost/gurps/ns/">
<meta>
<title>Hyalearl, 100-ton Sulieman-Class Scout/Courier</title>
<date>
<year>2008</year>
<month>03</month>
<day>10</day>
</date>
<copyright>All rights reserved 2008</copyright>
<author>Onno Meyer</author>
<email>none@none.com</email>
<TL>10</TL>
<background>Traveller</background>
<version>1.0</version>
</meta>
</vehicle>
--------------cut here---------------------
tom_a_sparks
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more