Subject: Re: Escaping within an xsl:attribute element From: "Brett McLaughlin" <bmclaugh@xxxxxxxx> Date: Thu, 9 Dec 1999 10:15:45 -0600 |
> > > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Escaping within an xsl:attribut, David Carlisle | Thread | Re: Escaping within an xsl:attribut, David Carlisle |
RE: Converting XML <link> to HTML a, Michael Teigman | Date | RE: Selection based on attribute va, Linda van den Brink |
Month |