[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Conditionally use attribute sets?
Subject: Re: [xsl] Conditionally use attribute sets? From: JBryant@xxxxxxxxx Date: Mon, 14 Nov 2005 10:11:15 -0600 |
It can be done. Consider the following stylesheet (which you can test by applying it to itself): <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="2.0" omit-xml-declaration="no" indent="yes"/> <xsl:param name="who"/> <xsl:attribute-set name="Oscar"> <xsl:attribute name="slob">yes</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="Felix"> <xsl:attribute name="slob">no</xsl:attribute> </xsl:attribute-set> <xsl:template match="/"> <bachelor> <xsl:choose> <xsl:when test="$who='Oscar'"> <xsl:attribute name="xsl:use-attribute-sets"> <xsl:value-of select="'Oscar'"/> </xsl:attribute> </xsl:when> <xsl:when test="$who='Felix'"> <xsl:attribute name="xsl:use-attribute-sets"> <xsl:value-of select="'Felix'"/> </xsl:attribute> </xsl:when> </xsl:choose> </bachelor> </xsl:template> </xsl:stylesheet> I tested that with Xalan Java 2.4.1 It's easier in 2.0 because <xsl:attribute name="xsl:use-attribute-sets"> <xsl:value-of select="'Oscar'"/> </xsl:attribute> can be <xsl:attribute name="xsl:use-attribute-sets" select="'Oscar'"/> I tested that with Saxon 8.5.1. Jay Bryant Bryant Communication Services (presently consulting at Synergistic Solution Technologies)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Conditionally use attribu, Michael Kay | Thread | Re: [xsl] Conditionally use attribu, David Carlisle |
Re: [xsl] Positioning labels in FOP, JBryant | Date | Re: [xsl] Conditionally use attribu, JBryant |
Month |