Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: style attribute sets?

From: "Joe Fawcett" <joefawcett@---------.------>
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





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent