Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Making XSLT Transform faster

From: Zest4Quest@-----------.---------.---
To: NULL
Date: 4/6/2009 11:02:00 AM
Hi,
  I am trying to make my xslt transformation faster.
Sample of my My XML is as follows.

<?xml version="1.0" encoding="utf-16"?>
<AssessmentData xmlns:i="http://www.w3.org/2001/XMLSchema-instance" >
  <PSHistory>
    <ContactedTime i:nil="true" />
    <DocumentationIncomplete>false</DocumentationIncomplete>
    <FamSocHistNotes i:nil="true" />
    <FirstAssessment>true</FirstAssessment>
    <HelpAtHome>2</HelpAtHome>
    <HelpAtHomeNo>true</HelpAtHomeNo>
    <HelpAtHomeYes>false</HelpAtHomeYes>
    <IsDirty>false</IsDirty>
  </PSHistory>
</AssessmentData>

My XSLT contains the following sample structure.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
exclude-result-prefixes="msxsl"
               xmlns:ms="urn:schemas-microsoft-com:xslt"
                xmlns:dt="urn:schemas-microsoft-com:datatypes">
 
  <xsl:output method="text" indent="yes"/>

  <xsl:template match="/">
    <xsl:for-each select="AssessmentData/PSHistory">
        <xsl:variable name ="SHVar" >
          <xsl:if test ="HelpAtHome = '1'">
            <xsl:text>has help at home, </xsl:text>
          </xsl:if>
          <xsl:if test ="HelpAtHome = '2'">
            <xsl:text>does not have help at home, </xsl:text>
          </xsl:if>         
        </xsl:variable>
        <xsl:if test ="string-length($SHVar) >0">
          <xsl:value-of select 
="substring($SHVar,1,string-length($SHVar)-2)"/>
          <xsl:text>. </xsl:text>
        </xsl:if>        
    </xsl:for-each>    
       
  </xsl:template>
</xsl:stylesheet>

Eventhough the PSHistory occurs only once in Assessments, i have used a 
xsl:for-each stmt. Could this be slowing down my Transformation? Is there 
anything i could do to speed up the Transformation?
I am new to XSLT.
Thanks in Advance for your help.





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