Strange output text appearing when template match is selecting more then data
This is an open discussion with 3 replies, filed under XSLT.
Search
@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.
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
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
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.