Hi,
> I'd like to conditionally add an attribute set to an
>element. Something like this:
You're not the only one :/
> <xsl:attribute-set name="my.set">
> <xsl:attribute name="attr">value</xsl:attribute>
> </xsl:attribute-set>
>
> <literal-res-elem>
> <xsl:if test="@condition">
> <xsl:use-attribute-sets name="my.set"/>
> </xsl:if>
> </literal-res-elem>
>
> But after the recommendation, it seems it's not possible:
No, you can use xsl:choose to generate two literal result elements, one with
the attribute set and one without. If you're into extensions, you can generate
a dummy RLE that has the attribute set, then cast that into a node-set and
then conditionally copy e:node-set($dummy)/*/@* but that's ugly. In some cases
you can stick the test into the xsl:attribute, but in your case it wouldn't
work as that way you can only control the value of the attribute, not the
occurrence. Clearly a case where XSLT forces you to just through few hoops.
Jarno
| Current Thread |
Jarno.Elovirta - 14 Nov 2005 10:07:41 -0000 <=
Jarno.Elovirta - 14 Nov 2005 12:17:11 -0000
Haarman, Michael - 14 Nov 2005 16:54:08 -0000
- JBryant - 14 Nov 2005 17:05:12 -0000
|
|