AprilWeb
05-15-2010, 09:15 PM
Hi,
I try to use xsl:template match="node" to yield nodes. Inside the xsl:template I printout "match found", to tell me if there is a match found.
In the result HTML (I open the XML in firefox), I see "match found" printed, but all sibling node of the matching node is always printed out.
I'm so confused, why is that? Please help!
I've attached the xml, xsl and output I got:
XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="book.xsl"?>
<main>
<boulevard>
<block>Panorama Street</block>
<block>Panorama Street</block>
</boulevard>
<parkway>
<thoroughfare name="Whitesburg Drive">
<sidestreet>Bob Wallace Avenue</sidestreet>
<sidestreet>Woodridge Street</sidestreet>
</thoroughfare>
</parkway>
</main>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="//main/boulevard">
<p>
found blvd
</p>
</xsl:template>
</xsl:stylesheet>
output:
found blvd
Bob Wallace Avenue
Woodridge Street
I try to use xsl:template match="node" to yield nodes. Inside the xsl:template I printout "match found", to tell me if there is a match found.
In the result HTML (I open the XML in firefox), I see "match found" printed, but all sibling node of the matching node is always printed out.
I'm so confused, why is that? Please help!
I've attached the xml, xsl and output I got:
XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="book.xsl"?>
<main>
<boulevard>
<block>Panorama Street</block>
<block>Panorama Street</block>
</boulevard>
<parkway>
<thoroughfare name="Whitesburg Drive">
<sidestreet>Bob Wallace Avenue</sidestreet>
<sidestreet>Woodridge Street</sidestreet>
</thoroughfare>
</parkway>
</main>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="//main/boulevard">
<p>
found blvd
</p>
</xsl:template>
</xsl:stylesheet>
output:
found blvd
Bob Wallace Avenue
Woodridge Street