RE: [xsl] removing tab formatting during XSLT?

Subject: RE: [xsl] removing tab formatting during XSLT?
From: "Richard Lander" <rlander@xxxxxxxxxxxxx>
Date: Thu, 10 Oct 2002 12:17:52 -0700
I've done this sort of thing before ... 

You have two problems, as I see it.

1- you are referencing a named entity (nbsp;) w/o really doing so. You would need to use '&nbsp;'. Still, that probably doesn't make any sense, given that a non-breaking space isn't the same as a tab.

2. You should search on '&#x9;' instead. I'm pretty sure that that is the tab character ...

-----Original Message-----
From: Macaulay,Malcolm (US) [mailto:Malcolm.Macaulay2@xxxxxxxxx] 
Sent: Thursday, October 10, 2002 10:55 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Could someone please enlighten me on how I can remove tab formatting from my resulting XML.

Here's an example:

Source XML:

<?xml version="1.0"?>
	<B att="att">a</B>

Desired output XML (i.e. the same as input but with all tabs removed):

<?xml version="1.0"?><A><B att="att">a</B><C>b</C><D>c</D></A>

XSLT (which doesn't work):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="";>
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
	<xsl:strip-space elements="*"/>
	<xsl:template match="/">
	<xsl:template match="*">
		<!-- recreate the element -->
		<xsl:element name="{name()}">
			<!-- copy existing attributes-->
			<xsl:for-each select="@*">
	<xsl:variable name="tab">nbsp;</xsl:variable>
	<xsl:template match="text()">
		<xsl:value-of select="translate(. , $tab , '')"/>

	<!-- original attempt	
	<xsl:template match="text()">
		<xsl:value-of select="normalize-space(.)"/>

I want to remove the tabs because this significantly reduces the size of the file.

Thanks in advance.



 XSL-List info and archive:

 XSL-List info and archive:

Current Thread