Streamlining XSL and transform performance (how does i
I am trying to do a sort of mail merge for creating wills and have been advised that an XSL transform is the best route to go down. The data is in XML format and I am just starting to convert the massive (200+ pages) html template into an XSLT document. The XML data is formatted as follows: <AnswerSet title = "Test File"> <Answer name = "ABGRbefore"> <RptValue> <TFValue>true</TFValue> <TFValue>false</TFValue> <TFValue>false</TFValue> </RptValue> </Answer> <Answer name = "Female"> <TFValue>false</TFValue> </Answer> <Answer name = "ticdesc"> <TextValue>my collection of teapots</TextValue> </Answer> </AnswerSet> There are around 3,000 elements in the XML file in total. I have so far worked out that at a simplistic level I can use the following XSL for extracting the data: <xsl:for-each select="AnswerSet/Answer[@name='Female']"> <xsl:if test="TFValue = 'true'"> <p>the user is female.</p> </xsl:if> <xsl:if test="TFValue = 'false'"> <p>the user is male.</p> </xsl:if> </xsl:for-each> <xsl:for-each select="AnswerSet/Answer[@name='ticdesc']"> <p><xsl:value-of select="TextValue"/></p> </xsl:for-each> Is this the most efficient way of extracting the data? Each time I want to extract a value, is the Processor having to loop through the XML file or does it do it in a single pass? I could break the template down into more manageable chunks, but am not sue how to import one template into another. Before I embark on a massive conversion process, I'm just wondering if I am going down the right route. Any pointers would be appreciated. -- Cheers, Julian Voelcker United Kingdom XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format