Generating CSS from XML: how to?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Kerr

    Generating CSS from XML: how to?

    Hi,

    After a quick Google turned up very little of use, I've turned to
    here. The question: has anyone tried to (or more usefully, succeeded
    in) generating CSS files from an XML document transformed using XSL?
    Is there an existing schema for CSS in XML? Would there be any
    benefit in such a thing?

    The reason I ask is because I'm about to embark on an overhaul of a
    large site which divides into similar sections with thematic design
    variations. The structure of the sections will be similar, but each
    section will have its own colour scheme. I would like to be able to
    have an XML document for each theme that would create a CSS file for
    that theme -- easier for content people to edit XML documents than
    CSS files, as they are already editing the content XML.

    Any help (or definite answers saying why it's a non-starter) would be
    useful.

    Thanks,

    Rob Kerr
    --
    "It's impossible for an Englishman to open his mouth without making
    some other Englishman despise him."
    -- G.B.S., "Pygmalion"
  • p.lepin@ctncorp.com

    #2
    Re: Generating CSS from XML: how to?


    Follow-ups to comp.text.xml.

    On Apr 13, 1:29 pm, Rob Kerr <robert.k...@bb c.co.ukwrote:
    The question: has anyone tried to (or more usefully,
    succeeded in) generating CSS files from an XML document
    transformed using XSL?
    I haven't but I see no reason why this wouldn't work,
    assuming you transform server-side and supply correct
    Content-Type when serving the result.

    Just use:

    <xsl:output method="text"/>
    Is there an existing schema for CSS in XML?
    Not to my knowledge.

    --
    Pavel Lepin

    Comment

    • Manuel Collado

      #3
      Re: Generating CSS from XML: how to?

      Rob Kerr escribió:
      Hi,
      >
      After a quick Google turned up very little of use, I've turned to
      here. The question: has anyone tried to (or more usefully, succeeded
      in) generating CSS files from an XML document transformed using XSL?
      I've been interested in such thing. It seems relatively simple, but
      found not enough spare time to try it. After reading your post, I've
      spent some time in searching the net, with partial success.
      Is there an existing schema for CSS in XML? Would there be any
      benefit in such a thing?
      >
      There is JXCSS: a CSS to XCSS (XML markup) converter.

      Home: https://jxcss.dev.java.net/
      Download: from the "Documents & files" left menu entry.
      Some reference:


      Regretably, the mentioned CSS in XML DTD (xcss.dtd) cannot be found in
      the distribution files, nor in the website (there is a broken page
      reference: https://jxcss.dev.java.net/css-dtd.html)

      The missing DTD can probably by inferred by processing css samples with
      JXCSS, or from the provided XSLT stylesheet (compact-xcss.xsl) to
      convert xcss to plain css.

      If you ever produce a XML DTD or schema for CSS, I'll be interested on
      it. Perhaps I could offer some collaboration, at least by discussing
      issues or testing the draft stuff.
      ...
      Any help (or definite answers saying why it's a non-starter) would be
      useful.
      Hope this helps.
      --
      Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

      Comment

      • Manuel Collado

        #4
        Re: Generating CSS from XML: how to?

        Manuel Collado escribió:
        Rob Kerr escribió:
        >...
        >Is there an existing schema for CSS in XML? Would there be any
        >benefit in such a thing?
        >
        There is JXCSS: a CSS to XCSS (XML markup) converter.
        A further search finds:

        CSSML, at: http://www.outer-court.com/tech/index.htm

        Perhaps too simple, but provides a DTD and ready-to-use tools.

        Regards.
        --
        Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

        Comment

        • Andy Dingley

          #5
          Re: Generating CSS from XML: how to?

          On 13 Apr, 11:29, Rob Kerr <robert.k...@bb c.co.ukwrote:

          The question: has anyone tried to (or more usefully, succeeded
          in) generating CSS files from an XML document transformed using XSL?
          Trivial, easy and just a bad idea, so don't do it.

          CSS is plain text. Use the right XSL output method and you can make
          some - anything you want, whatever content you like.

          However you shouldn't _need_ dynamic CSS. An apparent need for such a
          thing usually indicates that the HTML itself is broken and has
          inadequate specificity of usable selectors (i.e., get some better
          classes in there). If the selectors are adequate, then a _static_ CSS
          document can deliver all you need.

          This technique is often seen in conjunction with absolute CSS
          positioning, and indicating that the design positioning is inflexible.

          Comment

          Working...