I have stopped XSLT from rendering out all the text
but I am no further a long getting XSL stylescript  to work
I have been reading w3schools (http://www.w3schools.com/xsl/default.asp )
and XML 1.1 bible 3rd edition ( 
http://www.amazon.com/XML-Bible-Elliotte-Rusty-Harold/dp/0764549863 )
I am at a lost still!!
----------cut here--------------
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html" encoding="UTF-8"/>

<xsl:template match="/">
<html>
<head>
<title>vehicle: <xsl:value-of select="vehicle/meta/title" /></title>
</head>
<body>
<pre>
vehicle: <xsl:value-of select="vehicle/meta/title" />
</pre>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-----------cut here--------------

 tom_a_sparks


Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html




________________________________
From: Siegfried Gipp <siegfr...@rorkvell.de>
To: php-general@lists.php.net
Sent: Tuesday, 17 February, 2009 10:12:11 PM
Subject: Re: [PHP] XSLTProcessor help


On Monday, 16. February 2009 11:49:23 Tom Sparks wrote:
> help, when I include <xsl:apply-templates/>
> the XSLTProcessor only strips the XML tags and outputs the text see result
That is the xsl default behaviour. You need templates to do anything other with 
xml elements than just digging deeper.
This is somewhat like a built-in default template. For example you may think of 
this template as beeing built-in (until you write your own):
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
And for text (and attributes) you have something like this as "built-inb":
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
Additionaly, sometimes, if you _don't_ want that default behaviour on standard 
text, you need a template for this. So to avoid getting arbitrary text, you 
could add a template like this:
<xsl:template match="text()"/>
You may add this template to just copy the elements:
<xsl:template match="node()||@*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Sometimes this is called the "identity copy" or "identity template". I hope i'm 
correct here, just cited from memory :)


      Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to