Search

This is something I noticed and found strange, there may be a reason , work around, or more likely I'm just doing something wrong but I was hoping someone would maybe know a reason.

Anyway if I set my template match to something like

<xsl:template match="data/pages/entry">

then I get a weird garbled text output before my template, see attachment. It looks like the first couple xml nodes under params, in the debug.

but if I change it to just

<xsl:template match="data">

then it goes away and all is normal. Like I mentioned above I have no idea why it's like this but was hoping someone would have an explanation.

Thanks for any info.

Attachments:
Screen shot 2012-04-09 at 10.26.50 AM.png

@jchamb - Watch this apply-templates screencast from @Allen. This should help you understand how to apply-templates.

When you don't have an explicit template that matches data but have it in a select of a apply-templates (like <xsl:apply-templates select="/data"/>) the default implicit templates get applied. And those return the text value, like

<xsl:template match="*|/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="text()|@*">
    <xsl:value-of select="."/>
</xsl:template>

In other words, you are applying templates to a node that does not have a template defined for it. And then the implicit default templates get applied, which just return the text value.

Thanks Guys, Really appreciate the info.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details