I have an XSL stylesheet that I use to create xHTML fragments. The XML contains lots of information and I only want to transform one particular section, I match this like so (note this is my top level/first match):
<xsl:template match="root/SystemInfo/Errors">
This works great, however, before my intended output I see 1001 being written out. Upon further inspection this is the data of various tags that preceed my matched xpath "root/SystemInfo/Errors". What can I do to prevent this from happening?
Example xml:
<?xml version="1.0"?>
<root>
<Settings>
<Enabled>1</Enabled>
<Mode1>0</Mode1>
<Mode2>0</Mode2>
<Limit>1</Limit>
</Settings>
<SystemInfo>
<Errors>
<NOCONNECTION>1</NOCONNECTION>
</Errors>
</SystemInfo>
</root>
XML Playground setup here to show the effect.
Add
to override the default templates outputting text nodes or make sure you process only the stuff you are interested in with