Re: [xslt] xforms processor in pure xslt



On Mon, Aug 13, 2001 at 12:58:00AM +0200, Bernhard Zwischenbrugger wrote:
> I try to implement a (server side) xforms (http://www.w3.orf/xforms) processor
> in pure xslt.
> 
> It's not very difficult to do that, but there is one thing I can't solve.
> Maybe the concept is wrong, but maybe there is a simple solution.
[...]
> <!-- -->
> <!-- translate xforms elements to html forms -->
> <!-- -->
> <xsl:template name="textbox">
>         <input type="text" action="{@xform}" name="{@ref}" size="{@cols}">
>                 <xsl:attribute name="value">
>                         <!-- -->
>                         <!-- #### Here is the big problem ####-->
>                         <!-- -->
>                         <xsl:value-of 
> select="libxslt:node-set(document(//xfm:form/xfm:instance/@href)/$instance)"/>
>                         <!-- -->
>                         <!-- #### End of big problem ####-->
>                         <!-- -->
>                 </xsl:attribute>
>         </input>
> </xsl:template>
>  
> </xsl:stylesheet>
> 
> data.xml
> ======
> <?xml version="1.0"?>
> <all>
>         <one>first</one>
>         <two>second</two>
> </all>
> 
> The problem is to get values from data.xml to fill the
> form elements with default data.

  is the matching done by name of element/name of attribute ? If yes
it seems it should be possible to do without any extension. 

> It's possible to get the path to the data.xml from model.xml.
> But as I know, it isn't possible to get an xpath value from model.xml
> and select a value from data.xml using the xpath of the <instance> tag
> in the model.xml.

Yes, basically in XSLT all XPath expressions are supposed to be precompilable
and the XPath expression from XForm comes at runtime.

> Is there a simple solution for this problem?

Not really.

> Is it possible to write an extension function for this?

Well sure, it seems you need a function which makes a run-time compilation
and evaluation of XPath expressions. Check if it's not available already
in EXSLT, this would probably require only a dozen lines of C to implement.

> I know, using DOM it shouldn't be a big deal to imlement an xforms
> processor, but XSLT is the language I like.

Well the DOM XPath extension is still a Working Draft.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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