Re: [xslt] Setting xsl:output parameters on compiled stylesheets



>   I have reread the specific section in the XSLT-1.0 spec. It seems
> that the attribute of the xsl:output element should not influence
> any of the compilation steps,

 Good news.

> so modifying those specific element 
> should not generate incoherencies. There is no API for it but at least
> this sounds safe. If you have a good API to suggest, do so,

 I have only a couple of APIs in mind:

 1.  just provide a couple of ``high-level'' functions:

     // returns the value of a given property; returns NULL if the
     // property argument is not the name of a property
     xmlChar * xsltGetProperty(xsltStylesheetPtr style, xmlChar *property) 

     // set the value of a given property; returns the old value;
     // returns NULL if the property argument is not the name of a property
     xmlChar * xsltSetProperty(xsltStylesheetPtr style, xmlChar *property,
                            xmlChar *value)

    Open issue: when a property is not setted, what is the value that should
    be returned by xsltGetProperty? Two possibilities:
     A. the empty string
     B. the libxslt/XSLT default value (but for the "method" property the
        default value is not fixed, but it is dependent from the output)

    - Pros: the API will not change when more properties will be added to
    - Pros: user-friendly
    - Cons: "complex" implementation
    - Cons: if in the future XSLT will have a new property which interferes
            with the compilation phase, we will be obliged to return NULL
    - Cons: dynamic errors can occur

 2. provide a couple of get-set methods for every settable property XXX

    xmlChar * xsltGetPropertyXXXX(xsltStylesheetPtr style)
    xmlChar * xsltSetPropertyXXXX(xsltStylesheetPtr style, xmlChar *value)

    The open issue of 1. is open even in this case.

    - Pros: easy implementation
    - Pros: no dynamic errors (NULL is never returned)
    - Cons: much less user-friendly
    - Cons: the API must be extended every time a new property is add to
            XSLT


						Regards,
                                                C.S.C.

-- 
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://www.cs.unibo.it/~sacerdot
----------------------------------------------------------------



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