[libcroco-list] XML+CSS annotator example



Hi,

  I wrote a quick hello world example using libxml2 and libcroco, see
http://lists.w3.org/Archives/Public/www-archive/2004Jun/att-0000/cssanno.c

  /*
    cssanno.c -- annotate XML documents with CSS declarations
  
    Usage:
  
      cssanno file.xml file.css
  
    cssanno takes an XML document and a CSS style sheet and
    annotates the elements with new attributes representing
    the style declarations for the current element. Example:
  
      <?xml version='1.0' encoding='utf-8'?>
      <foo><bar/><baz/></foo>
  
    with a style sheet
  
      foo           { display: block }
      bar           { color: red }
      baz           { font-family: "Arial Unicode MS" }
      *:first-child { white-space: normal }
  
    would result in an XML document like
  
      <?xml version="1.0" encoding="utf-8"?>
      <foo xmlns:css           = "http://example.org/css#";
           css:display         = "block"
           css:white-space     = "normal">
          <bar css:color       = "red"
               css:white-space = "normal" />
          <baz css:font-family = "&quot;Arial Unicode MS&quot;" />
      </foo>
  
  ...
  
  */

It's not perfect, but it might be useful for beginners. Maybe something
similar would be useful for testing...

regards.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]