asylum Posted May 28, 2006 Share Posted May 28, 2006 This is a piece of code from my .xsl file and when I try to assign the attribute src directly to background-image it works but I can't put that xsl declaration in quotes which I need to do so I decided to use a variable...but it just doesn't work...at all. <?xml version="1.0" encoding="ISO-8859-1" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/content"><xsl:variable name="source" select="bglayer/attribute::src"/><html><head><style type="text/css">#body { background-image: url("{$source}"); position: relative; width: <xsl:value-of select="bglayer/attribute::width"/>; height: <xsl:value-of select="bglayer/attribute::height"/>;}.item { margin: 5px;}</style></head><body> <div id="body"> <xsl:apply-templates/> </div></body></html></xsl:template> Link to comment Share on other sites More sharing options...
boen_robot Posted May 28, 2006 Share Posted May 28, 2006 Wouldn't a simple background-image: url("<xsl:value-of select="bglayer/attribute::src"/>"); do the trick? Parenthesis as far as I know are only used inside attribute values. CSS however is consireder plain text, so <xsl:value-of> is the way to go.Oh, and just a tip. Why don't you use the "@" instead of "attribute::"? Link to comment Share on other sites More sharing options...
asylum Posted May 28, 2006 Author Share Posted May 28, 2006 Wouldn't a simplebackground-image: url("<xsl:value-of select="bglayer/attribute::src"/>"); do the trick? Parenthesis as far as I know are only used inside attribute values. CSS however is consireder plain text, so <xsl:value-of> is the way to go.Oh, and just a tip. Why don't you use the "@" instead of "attribute::"? <{POST_SNAPBACK}> Thanks for the help. And I used the attribute:: because I thought the two were different. I thought the @ gave you the element with that attribute and the attribute:: would give you the actual attribute. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now