Subject: Re: [xsl] Using XSL and schemas to create form-editable xml files From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Tue, 27 Feb 2001 11:41:38 +0000 |
Hi Chris, > Has anyone found pleasant workarounds to the following problems: > > 1. can't use variables to name new xsl:elements Well you can - you can use an attribute value template in the name attribute of xsl:element. For example, if you have: <xsl:variable name="foo" select="'bar'" /> <xsl:element name="{$foo}" /> then you get the empty element: <bar /> > 2. can't use variables to name new xsl:attributes Again, you can - you can use an attribute value template in the name attribute of xsl:attribute as well. For example, if you have: <foo> <xsl:variable name="foo" select="'bar'" /> <xsl:attribute name="{$foo}">baz</xsl:attribute> </foo> then you get the empty element: <foo bar="baz" /> > 3. xsl:copy, when used on attributes, can't have a template body If you want to change the value of an attribute, then there's no point in copying it - a copy is a copy, so it has the same value. Instead, you can use the above facility - the attribute value templates - to create a new attribute with the same name (and namespace) and put whatever content you want in it: <xsl:attribute name="{name()}" namespace="{namespace-uri()}"> ... template body ... </xsl:attribute> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using XSL and schemas to crea, Chris Kilner | Thread | Re: [xsl] Using XSL and schemas to , David Carlisle |
RE: [xsl] I'm really annoyed!!!!, Jo Kong HO | Date | RE: [xsl] I'm really annoyed!!!!, Chris Bayes |
Month |