[xsl] Template/for-each/Firefox

Subject: [xsl] Template/for-each/Firefox
From: Brett Zamir <brettz9@xxxxxxxxx>
Date: Thu, 01 Sep 2005 09:30:22 -0700
Along the lines of the question of the difference between for-each and
apply-templates, when trying to transform, the following I get different
results from the subsequent stylesheets (the text after the embedded element
doesn't show up in the latter, even if I included another text() value-of
statement), and I don't know why.

I also don't know why I need to specify "/pars" in the last template as I
thought "pars" is already the root (if I don't do it, Firefox will not show
anything).

Also, I don't understand why in Firefox, refreshing the page does not always
accurately reflect the changes I've made...I have to sometimes close the tab
and start another one to see the changes. Some caching problem or?

I am also having trouble figuring out why call-template does not seem to
work for me (using it like apply-templates but for just one template).

thanks in advance,
Brett



<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<pars>
<par>The first part <embedded>comes before</embedded> the second part</par>
<par>The third part <embedded>also comes before</embedded> the fourth
part</par>
</pars>

-----------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>

<xsl:template match="/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="embedded">
    <b><xsl:value-of select="."/></b>
</xsl:template>

<xsl:template match="text()">
    <b><xsl:value-of select="."/></b>
</xsl:template>

</xsl:stylesheet>


-----------------------------------


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>

<xsl:template match="/pars">
    <xsl:for-each select="par">
        <b><xsl:value-of select="text()"/></b>
        <b><xsl:value-of select="embedded"/></b>
    </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Current Thread