CSS in XSLT writing wrong path when publishing

fuelishways's Avatar

fuelishways

21 Aug, 2012 05:37 AM

In my XSLT, i'm trying to use this tag:
<div class="mainHero" style="background-url: {mainHero/path}">

when published the path looks something like this:
/WRAP_SDDU/IUK-IUK-CAMPUS/IUB-migration/alumni/img/bgHero.jpg

how can i get it to write the correct path on publish?

  1. 1 Posted by Ryan Griffith on 21 Aug, 2012 12:42 PM

    Ryan Griffith's Avatar

    Hi fuelishways,

    I don't believe background-url is valid CSS property, I think you would want to use background-image: url(). Let's try the following:

    <div class="mainHero" style="background-image: url({mainHero/path})">
    
  2. 2 Posted by fuelishways on 21 Aug, 2012 01:31 PM

    fuelishways's Avatar

    yes, sorry, I had copied the wrong code. I did update it to your valid property and it is still publishing the full cascade server path. any ideas?

  3. 3 Posted by Ryan Griffith on 21 Aug, 2012 01:38 PM

    Ryan Griffith's Avatar

    It sounds like the URL path in the inline-style isn't being tracked by Cascade. Let's try the following to see if we can force the tracking:

    <div class="mainHero" style="background-image: url([system-asset]{mainHero/path}[/system-asset])">
    
  4. 4 Posted by fuelishways on 21 Aug, 2012 01:48 PM

    fuelishways's Avatar

    great! that seemed to work now. when does the [system-asset] tag need to be used? I've never had to use that tag before.

  5. 5 Posted by Ryan Griffith on 21 Aug, 2012 01:59 PM

    Ryan Griffith's Avatar

    Glad to hear that did the trick!

    Cascade will rewrite links/paths for the more common attributes such as href and src, here is a list of some of the attributes that Cascade will track.

    For something like inline styles (ie url()) you would need to add in the [system-asset][/system-asset] pseudo tags, very similar to adding tracked links within files (eg CSS stylesheets). Here is some additional information about tracked links within Files and non-recognized attributes.

    Please let us know if you have any questions.

    Thanks!

  6. Ryan Griffith closed this discussion on 22 Aug, 2012 01:43 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac