javajoemorgan Posted February 8, 2008 Share Posted February 8, 2008 OK... I've got a transform from XML to HTML. The HTML will include some CSS. I need the contents of an XSL variable as part of an image background for a div class.However, the parser seems to be ignoring the {$xslVar} because it is inside the css like this: .banner { background-image: {$xslVar} } I know it is being ignored rather than wrong because I added an <IMG SRC="{$xslVar}"/>... and that worked.So, though I already have my work around, I am more curious than stuck... how can I do it? Link to comment Share on other sites More sharing options...
boen_robot Posted February 8, 2008 Share Posted February 8, 2008 Your whole CSS is a single text node. And variable references are part of XPath expressions. AVTs (the "{" and "}" with an XPath expression inside) can only be used in attribute values, as their name implies.Having said that, how do you output the contents of anything in XSLT when you're in a text node (i.e. element't content)? You're a smart guy, I'll let you try to figure that out. Link to comment Share on other sites More sharing options...
javajoemorgan Posted February 8, 2008 Author Share Posted February 8, 2008 You're a smart guy, ....Who's been lying to you? Link to comment Share on other sites More sharing options...
boen_robot Posted February 8, 2008 Share Posted February 8, 2008 Who's been lying to you? Ehehehe... well... you sure appear(ed) such. Sorry if I have offended you .OK, well, it's value-of. A darn value-of, like this:.banner { background-image: <xsl:value-of select="$xslVar"/> } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.