[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] local variables as entity reference in different style
Hi there (3rd try), In stylesheets a.xsl, b.xsl and c.xsl I use the same local variables (not top-level, but inside templates). I think the easiest way to do this, is to make use of 'variables.xsl' as an entity-reference (&variables;). In fact, this is the way I do it. The only ugly thing about it, is that I have to put "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" into each variable, because I can't think of a suitable root element. It looks like this: <xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="attributes"> <xsl:call-template name="list"> <xsl:with-param name="elements" select="normalize-space(attributes)"/> <xsl:with-param name="mode" select="'alias'"/> </xsl:call-template> </xsl:variable> <xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="attributevals"> <xsl:call-template name="list"> <xsl:with-param name="elements" select="normalize-space(attributes)"/> <xsl:with-param name="mode" select="'value'"/> </xsl:call-template> </xsl:variable> Another way to do this, is to make use of a "dummy" root element, like this: <root xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="attributes"> <xsl:call-template name="list"> <xsl:with-param name="elements" select="normalize-space(attributes)"/> <xsl:with-param name="mode" select="'alias'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="attributevals"> <xsl:call-template name="list"> <xsl:with-param name="elements" select="normalize-space(attributes)"/> <xsl:with-param name="mode" select="'value'"/> </xsl:call-template> </xsl:variable> </root> It works, but I would like to know what is considered to be "best practice". Thanx, Marko Draisma. 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
|