|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Escaping within an xsl:attribute element
>
> > It all has to be within the xsl:attribute
>
> But your example stylesheet you posted was did _not_ have the code
> inside xsl:attribute.
Sorry, David, you've been helpful and I am confusing the matter because I
haven't had my morning coffee... it should have all been inside the
xsl:element, which makes more sense to you (I hope). Once I replaced nowrap
with nowrap="nowrap", with  , and pulled out the xsl-text
element (which I actually had already done), it transformed fine, with the
desired results.
>
> You can not have element markup inside attribute values in XML (or HTML)
> so there is no way to get elements into attribute values, irrespective
> of xsl syntax.
Right, again, that was my dumb typo :-(
>
> > <tr bgcolor="<something-defined-in-my-xml>">
>
> to get that you just want
>
> <tr bgcolor="{@color}">
Here's what it ended up looking like:
<xsl:element name="tr">
<xsl:attribute name="bgcolor">
<xsl:value-of
select="/Portal:Page/Portal:Preferences/Portal:trimColor"/>
</xsl:attribute>
<td valign="bottom" align="left" nowrap="nowrap">
<xsl:element name="font">
<xsl:attribute name="face">
<xsl:value-of
select="/Portal:Page/Portal:Preferences/Portal:fontFace"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of
select="/Portal:Page/Portal:Preferences/Portal:trimFontColor"/>
</xsl:attribute>
<xsl:attribute name="size">
<xsl:text>-1</xsl:text>
</xsl:attribute>
<b>
   Welcome,
<xsl:value-of select="/Portal:Page/Portal:User/Portal:firstName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="/Portal:Page/Portal:User/Portal:lastName"/>
      
</b>
</xsl:element>
</td>
<td align="right" colspan="2">
<nobr/>
 
</td>
</xsl:element>
>
> or any other expression instea dof @color to extract the data from your
> input.
I wouldn't think I could do this because the value of color is defined in an
XML element, not an attribute, so I have to use an xsl:value-of to pull it
out of the document. Of course, there may be a better way to do this and I
am more than open to it.
Thanks,
Brett
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








