Re: [xsl] Template problem.Unnecessary text displayed

Subject: Re: [xsl] Template problem.Unnecessary text displayed
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 20 Dec 2001 17:57:20 +0100
No, it's not impossible. I assume that you have <xsl:apply-templates/> in your template - exactly in this form. This is the same like <xsl:apply-templates select="node()"/>. node() means text() + * + comment() + processing-instruction(). So for your unwelcome text there is searched a matching template, which you don't seem to have. So the built-in template will be used, which outputs the text-node.

To avoid the text either make a empty template <xsl:template match="text()"/> or specify the select at the <apply-templates>:

<xsl:apply-templates select="*"/>

Hope this helps,

Joerg


Tarun Saheja wrote:


Hi

Thanks You very much...,

I think I have one more problem. Now I have to use apply-templates in my
Parameter template. If that is the case, is it impossible to avoid the text
from being displayed.

Thanks, Tarun.

-----Original Message-----
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes

Tarun,
It shouldn't do. Unless you have an apply-templates in your Parameter
template in which case it will use the builtin template and output the
text node.

Ciao Chris

-----Original Message-----
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
Tarun Saheja

Hi,

When I am creating a template of name say "Parameter", it
displays the value of the "Parameter" tag on its own on the page.

For eg My XSL is...:

<xsl:template match="Parameter">
	<tr>
		<xsl:for-each select="Values">
			<td>Value of </td>
			<td><xsl:value-of select="Values"/></td>
		</xsl:for-each>
	</tr>
</xsl:template>


My XML is....


<Parameter>
This is value for the parameter tag
	<Values>
		Value1
	</Values>
	<Values>
		Value2
	</Values>
	<Values>
		Value3
	</Values>

</Parameter>


My HTML is displayed in such a manner... output starts.... ---------------------------------------------------------------- This is value for the parameter tag

Value of 	Value1
Value of 	Value2
Value of 	Value3
------------------------------------------------------------------
output ends....

The problem is that I dont want the text "This is value for
the parameter tag", (as displayed in the output) to be displayed.

Regards,
Tarun


--

System Development
VIRBUS AG
Fon  +49(0)341-979-7411
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de

Ihr VIRBUS-Team wünscht Ihnen eine friedvolle Weihnachtszeit und einen guten Rutsch ins neue Jahr!


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread