This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Using XSL and schemas to create form-editable xml files
- To: Chris Kilner <chris at xoo dot co dot uk>
- Subject: Re: [xsl] Using XSL and schemas to create form-editable xml files
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Tue, 27 Feb 2001 11:41:38 +0000
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <B6C13C8C.605F%chris@xoo.co.uk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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