xsl-list
[Top] [All Lists]

RE: XSLT and unexpected text ouput?

2004-04-28 09:59:45
Sounds like the default templates are being called.  You'll probably need to do 
something like <xsl:template match="InsertMatchHere"/> to replace the default 
templates with templates which don't output anything.

For example, if I had some XML that looked like:
<root>
        <branch1>...content...</branch1>
        <othernode>...content...</othernode>
</root>

and an XSLT stylesheet which only had the following template:
<xsl:template match="branch1">
        ...do stuff...
</xsl:template>

I would get all the leaf content of othernode underneath the branch1 processed 
output.  To avoid getting the othernode content, I would need to add an 'empty' 
template to override the default template, like this:
<xsl:template match="othernode"/>

        - Theo

-----Original Message-----
From: Jon Schwartz (Volt) [mailto:a-jonsch(_at_)microsoft(_dot_)com]
Sent: Wednesday, April 28, 2004 12:52 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSLT and unexpected text ouput?


I have seen this only a couple times, and without giving away our future
product can't send XML and XSLT to demonstrate it.  But I'm hoping I can
describe the general behavior and one of you will have seen this kind of
thing before.

I am converting XML to HTML.  A chunk of XML content in one branch of
the XML tree is rendered as I want it to without a problem. But at the
bottom of the HTML file - in fact after my closing </HTML> - the text
content of a series of leaf nodes in an entirely different branch of the
XML are streamed onto the end of the file.  I have checked carefully and
tried tweaking data, I have stepped through this in XSelerator - there
is no XSLT match or code which is causing this to happen.

I tried switching the order of the XML branches, so that the one I want
to render is below the other in the file.  Now the leaf content from the
unwanted branch is streamed ABOVE the HTML that I want - so the behavior
IS dependent on the order in the XML.

I am using MSXML for the transform.  Have any of you seen this before?
A workaround would be greatly appreciated.

Thanks,

Jon Schwartz


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



<Prev in Thread] Current Thread [Next in Thread>