Re: XSLTProcessor help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :)

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux