2 Replies Latest reply on Feb 17, 2010 5:41 AM by scphantm.scphantm.gmail.com

    best way to do dynamic style sheet

    scphantm.scphantm.gmail.com

      unfortunately my app requires a dynamic style sheet.  in the php world i did this pretty easy with


      .kb_but_0_up {
           background-image: url(<%= $varfileurl %>);
      }


      in a php file and then just a simple


      <link class="component" href="dynamiccss.php" rel="stylesheet" type="text/css" />



      done it for years, worked great.  now im trying to do the same in seam so in my dynamiccss.xhtml file i have



      .kb_but_0_up {
           background-image: url(#{keyboardGenerator.getKeyboardFile(0, 'ZERO')});
      }



      and i reference it


      <a:loadStyle src="/stylesheet/dynamicCSS.seam" />



      everything renders ok, but when i try to pull up the style sheet i get an exception


      21:11:39,248 ERROR [viewhandler] Error Rendering View[/stylesheet/dynamicCSS.xhtml]
      com.sun.facelets.FaceletException: Error Parsing /stylesheet/dynamicCSS.xhtml: Error Traced[line: 2] Content is not allowed in prolog.
           at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)



      are there any tags in seam that i can insert into my xhtml page that will end up rendering it as a valid css file?


      and before you say it, no i can't do an inline stylesheet.  for some reason when i do it adds several additional pagebreaks to the file and screws up printing the reports