Question about CSS and XML

Discussion in 'XML' started by kdjansen@args.k12.va.us, Jun 17, 2008.

  1. 12.va.us

    12.va.us Guest

    I've been using XML to define 3d map geometry for a game engine, like
    this:

    <wall x1="-1000" y1="300" x2="1000" y2="300" z="0" height="100"
    texture="nature/wood001" />

    However, I would like specify the texture not by a filename, but by a
    CSS style, like this:

    <wall x1="-1000" y1="300" x2="1000" y2="300" z="0" height="100"
    style="texture-group: nature; texture-resolution: xx-high; texture-
    family: wood; target: wall;" />

    because textures could then be defined with external stylesheets and
    allow reuse with class attributes.

    However, there are no CSS specifiers for things like textures or image
    resolution.

    I have looked into other things like XSLT, but those are not what I'm
    looking for (although I did use XSLT to make SVG overview maps)

    Is there any way to create custom CSS attributes and apply it to an
    XML document? Or at least a library that will store non-standard
    attributes?
     
    12.va.us, Jun 17, 2008
    #1
    1. Advertising

  2. > However, there are no CSS specifiers for things like textures or image
    > resolution.


    So you first need to invent the markup conventions for those properties.
    I'd suggest separate attributes rather than CSS strings, since distinct
    properties are easier for software to manipulate than a string which has
    to be re-parsed every time.

    I suspect XSLT is, in fact, the simplest way to apply non-CSS styling to
    a document.

    CSS really is HTML-oriented. XSLT is a more general tool.
     
    Joseph J. Kesselman, Jun 17, 2008
    #2
    1. Advertising

  3. 12.va.us

    12.va.us Guest

    On Jun 17, 2:27 pm, "Joseph J. Kesselman" <>
    wrote:
    >  > However, there are no CSS specifiers for things like textures or image
    >  > resolution.
    >
    > So you first need to invent the markup conventions for those properties.
    > I'd suggest separate attributes rather than CSS strings, since distinct
    > properties are easier for software to manipulate than a string which has
    > to be re-parsed every time.
    >
    > I suspect XSLT is, in fact, the simplest way to apply non-CSS styling to
    > a document.
    >
    > CSS really is HTML-oriented. XSLT is a more general tool.


    I have tried using separate attributes, but they are not as reusable
    and do not cascade.

    CSS (or something similar) strings are the best way I can think of.

    I am looking into SAC to parse this. I may have to modify it to accept
    non-HTML-CSS, but it beats writing my own parser from scratch.

    Speed is not a significant issue, since I am converting it into a
    series of C arrays and structures at load time.
     
    12.va.us, Jun 17, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    4
    Views:
    757
    clintonG
    Dec 24, 2004
  2. =?ISO-8859-1?Q?G=E9rard_Talbot?=

    Whining and bitching about MSIE 6 CSS bugs and CSS support

    =?ISO-8859-1?Q?G=E9rard_Talbot?=, Jul 9, 2005, in forum: HTML
    Replies:
    0
    Views:
    431
    =?ISO-8859-1?Q?G=E9rard_Talbot?=
    Jul 9, 2005
  3. Replies:
    6
    Views:
    575
    Jonathan N. Little
    Mar 18, 2006
  4. richard
    Replies:
    12
    Views:
    781
    dorayme
    Mar 9, 2010
  5. Erik Wasser
    Replies:
    5
    Views:
    500
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page