[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Optimization issue with includes and attribute-sets
Greetings! Using xslt 2.0, xpath 2.0, xsl-fo, saxon8b: I have a stylesheet that contains all of my attribute sets for a complex transformation. The templates are modularized in separate files that may include the attributes.xsl and one or more of the other templates. This is causing the attribute set to be applied once for every file that directly or indirectly references it - sometimes 20 times for a single block. While this doesn't cause a problem in the output, it sure is not optimized. For example, the code below applies each attribute set twice. I had a similar problem when one of the files contained a named template. I had to change the include to import to avoid the duplicate template error, but that doesn't fix this issue. What do I need to do to resolve this, seemingly bizarre, behavior? Thanks in advance! Angela Williams, Developer The 401(k) Company <!-- main-junk.xsl --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:include href="junk2.xsl" /> <xsl:include href="junk3.xsl" /> <xsl:template match="/"> <xsl:apply-templates select="*" /> </xsl:template> </xsl:stylesheet> <!-- junk2.xsl --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:include href="attributes.xsl" /> <xsl:template match="test"> <fo:block xsl:use-attribute-sets="test"> Test: <xsl:value-of select="." /> </fo:block> </xsl:template> </xsl:stylesheet> <!-- junk3.xsl --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:include href="attributes.xsl" /> <xsl:template match="text"> <fo:block xsl:use-attribute-sets="text"> Text:<xsl:value-of select="." /> </fo:block> </xsl:template> </xsl:stylesheet> <!-- attributes.xsl --> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:attribute-set name="text"> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="font-size">16pt</xsl:attribute> <xsl:attribute name="font-color">red</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="test"> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="font-size">24pt</xsl:attribute> <xsl:attribute name="font-color">blue</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> </xsl:attribute-set> </xsl:stylesheet> <!-- junk.xml --> <?xml version="1.0" encoding="UTF-8"?> <junk> <test>Testing it</test> <text> This is the text.</text> </junk>
|
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
|