<apidoc:module name="CSSModule" category="CSS Conversion" bucket="CPF Functions" 
  xmlns:apidoc="http://marklogic.com/xdmp/apidoc"
  xmlns="http://www.w3.org/1999/xhtml" lib="css"
>
<apidoc:summary access="public">
<p>The CSS module is part of the conversion processing pipeline.
These functions are used to manipulate CSS (Cascading style sheets) as part 
of conversion processing.
</p>
<p>To use the CSS module as part of your own XQuery module, include the
following line in your XQuery prolog:
</p>
<p><code>import module namespace css = "http://marklogic.com/cpf/css"
         at "/MarkLogic/conversion/css.xqy";</code></p>
<p>You will need to ensure that the CSS module is loaded into the same modules
database as the importing module.</p>
<p>The library namespace prefix <code>css</code> is <em>not</em> predefined in
the server.</p>
</apidoc:summary>

<apidoc:function name="get" type="css" lib="css" category="CSS Conversion" bucket="CPF Functions">
  <apidoc:summary>
Fetch the CSS for the given document, be it embedded or linked.
Limitation: doesn't account for @import directives in the CSS; assumes
the linked CSS is in the database.
  </apidoc:summary>
  <apidoc:params>
    <apidoc:param name="doc" type="xs:string">
    The name of the parent document.
    </apidoc:param>
  </apidoc:params>
  <apidoc:return> xs:string </apidoc:return>
  <apidoc:example><pre xml:space="preserve"><![CDATA[
  xquery version "1.0-ml";
  import module namespace css = "http://marklogic.com/cpf/css" 
		  at "/MarkLogic/conversion/css.xqy";

  css:get("http://example.com/mydoc.xhtml") 
  ]]></pre>
  </apidoc:example>
</apidoc:function>

<apidoc:function name="convert" type="css" lib="css" category="CSS Conversion" bucket="CPF Functions">
  <apidoc:summary>
   Convert CSS text to an equivalent XML representation that is more suitable
   for analysis.
  </apidoc:summary>
  <apidoc:params>
    <apidoc:param name="css" type="xs:string">
    The CSS text itself. 
    </apidoc:param>
    <apidoc:param name="options" type="element()?">
    Options for the conversion. The following options are defined:
    "html-style", the name of the CSS class on the "html" element;
    "body-style", the name of the CSS class on the "body" element.
    These style names are used to improve weighting heuristics.
    The options are in the "css:convert" namespace.
    </apidoc:param>
  </apidoc:params>
  <apidoc:return> element(css:styles)? </apidoc:return>
  <apidoc:example><pre xml:space="preserve"><![CDATA[
  xquery version "1.0-ml";
  import module namespace css = "http://marklogic.com/cpf/css" 
		  at "/MarkLogic/conversion/css.xqy";

  css:convert( css:get("http://example.com/mydoc.xhtml"), () )
  ]]></pre>
  </apidoc:example>
</apidoc:function>

</apidoc:module>
