dlink
05-13-2009, 02:50 AM
I have two files: XML and XSL.
Here they are:
XML:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="xsl.xsl"?>
<source>
<AAA id="a1" pos="start">
<BBB id="b1"/>
<BBB id="b2"/>
</AAA>
<AAA id="a2">
<BBB id="b3"/>
<BBB id="b4"/>
<CCC id="c1">
<CCC id="c2"/>
</CCC>
<BBB id="b5">
<CCC id="c3"/>
</BBB>
</AAA>
<AAA>
Text
</AAA>
</source>
XSL:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="http://www.microsoft.com">
<xsl:output method="html" indent="yes" encoding="utf-8"/>
<xsl:template match="/">
<xsl:apply-templates select="AAA" />
</xsl:template>
<xsl:template match="AAA">
<b>
<xsl:text>dfdfdf----</xsl:text>
<xsl:value-of select="@id"/>
<xsl:value-of select="."/>
</b>
<br/>
</xsl:template>
</xsl:stylesheet>
Why I see empty screen when I test it in browser?
If change from 'select="AAA"' to 'select="//AAA"' all works fine.
Here they are:
XML:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="xsl.xsl"?>
<source>
<AAA id="a1" pos="start">
<BBB id="b1"/>
<BBB id="b2"/>
</AAA>
<AAA id="a2">
<BBB id="b3"/>
<BBB id="b4"/>
<CCC id="c1">
<CCC id="c2"/>
</CCC>
<BBB id="b5">
<CCC id="c3"/>
</BBB>
</AAA>
<AAA>
Text
</AAA>
</source>
XSL:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="http://www.microsoft.com">
<xsl:output method="html" indent="yes" encoding="utf-8"/>
<xsl:template match="/">
<xsl:apply-templates select="AAA" />
</xsl:template>
<xsl:template match="AAA">
<b>
<xsl:text>dfdfdf----</xsl:text>
<xsl:value-of select="@id"/>
<xsl:value-of select="."/>
</b>
<br/>
</xsl:template>
</xsl:stylesheet>
Why I see empty screen when I test it in browser?
If change from 'select="AAA"' to 'select="//AAA"' all works fine.