[xsl] RE: Walking through text with embedded tags

Subject: [xsl] RE: Walking through text with embedded tags
From: "Bruce Kyle \(Volt\)" <a-bkyle@xxxxxxxxxxxxx>
Date: Wed, 19 May 2004 11:07:35 -0700
Hello Ken and all,

Thanks so much for your answer, Ken. It led me to my issues.  I
discovered I had two issues. 

1) I wasn't letting the default template help me. This is a new idea to
me. I have always though of it as a pain point to prevent duplication of
text. 
2) I didn't have a template handling my root node <test> so I was
getting duplicate text. I incorrectly thought the duplicate text was
coming from my default template or lack of it.

This is the correct stylesheet to support my nested links.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:msxsl="urn:schemas-microsoft-com:xslt">

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

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

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

<xsl:template match="a">
    <b><xsl:value-of select="@cref" /></b>
</xsl:template>

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

<xsl:template match="d"></xsl:template>

<xsl:template match="*|text()">
	<xsl:value-of select="." />
	<xsl:apply-templates />
</xsl:template>

</xsl:stylesheet>

Thanks so much for helping me understand the default template better.

bruce

Current Thread