Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - style attribute sets? >Thread Next - Re: style attribute sets? Re: style attribute sets?To: NULL Date: 1/5/2006 8:48:00 AM "Egbert Nierop (MVP for IIS)" <egbert_nierop@n...> wrote in
message news:eiGiQ$XEGHA.2040@T......
> Hi,
>
> This works
> <a><xsl:attribute name="name">
> <xsl:value-of select="bookmark" />
> </xsl:attribute>
> <xsl:value-of select="Content"/></a>
>
> it produces <a name="mybookmark>bla bla</a>
>
> now what I would like to do is to modify a style attribute
>
>
> so that the output would be (just a sample)
>
> <td style="width:20;left-margin:10px">blah </td>
>
> so you see, style should be filled with 2 or more attributes using xsl.
>
> I've been looking at attribute-set but that does not work.
There's no simple way, you can set all style information together,:
<a><xsl:attribute name="name">
<xsl:value-of select="bookmark" />
</xsl:attribute>
<xsl:attribute name="style">
<xsl:value-of select="concat('width:20', ';', 'left-margin:10px')" />
</xsl:attribute>
<xsl:value-of select="Content"/></a>
replacing the hardcoded values with XPath if needed.
Alternatively you can build up the style value using some sort of named
template:
<xsl:variable name="linkStyle">
<xsl:call-template name="linkStyleBuilder" />
</xsl:variable>
<a><xsl:attribute name="name">
<xsl:value-of select="bookmark" />
</xsl:attribute>
<xsl:attribute name="style">
<xsl:value-of select="$linkStyle" />
</xsl:attribute>
<xsl:value-of select="Content"/></a>
--
Joe Fawcett (MVP - XML)
https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
