Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL really slow please help

From: dba <bryanmurtha@-----.--->
To: NULL
Date: 3/12/2009 11:51:00 AM
I appreciate the advise, but it's a .NET 1.1 app I'm maintaining. I
can't re-write it in the time constraints I have, I just need to add
in a new export type. What strikes me as strange is that we have other
style sheets that produce tab delimited text, or csv, with the same
amount of data but don't have the performance issues of this xsl.

<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">
<xsl:output method="text" indent="no"/>
<xsl:variable name="delimiter" select="'	'"/>
<xsl:variable name="delimiterReplacement" select="'    '"/>
<xsl:variable name="poundsign" select="'_x0023_'"/>
<xsl:variable name="EOL" select="'
'"/>

<xsl:template match="/">
	<xsl:for-each select="/*/*[position()=1]">
		<xsl:for-each select="*">
			<xsl:choose>
				<xsl:when test="contains(name(.), $poundsign)">
					<xsl:value-of select="concat(substring-before(translate(name(.),
$poundsign, '#'), '##'), '#', substring-after(translate(name(.),
$poundsign, '#'), '##'))"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="name(.)"/>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="not(position() = last())">
				<xsl:value-of select="$delimiter"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:for-each>
	<xsl:value-of select="$EOL"/>
	<xsl:for-each select="/*/*">
		<xsl:for-each select="*">
			<xsl:value-of select="translate(translate(., $EOL, ' '),
$delimiter, $delimiterReplacement)"/>
			<xsl:if test="not(position() = last())">
				<xsl:value-of select="$delimiter"/>
			</xsl:if>
		</xsl:for-each>
		<xsl:value-of select="$EOL"/>
	</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I'm just trying to figure out how to do something similiar but with a
different target format.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent