Rev. 550 includes a new experimental action named "setnode" with @inner 
or @outer attributes to perform a "loadXML" for the corresponding node.

Here is a test case:
<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:xf="http://www.w3.org/2002/xforms"; 
xmlns:ev="http://www.w3.org/2001/xml-events";>
   <head>
     <title>Inner &amp; Outer Set Node</title>
     <xf:model>
             <xf:instance>
                 <data xmlns="">
                     <item>a</item>
                 </data>
             </xf:instance>
         </xf:model>
   </head>
   <body>
     <h1>Inner &amp; Outer Set Node</h1>
     <xf:output value="item"/>
     <xf:trigger>
         <xf:label>Inner</xf:label>
         <xf:setnode ref="." ev:event="DOMActivate" 
inner="'&lt;item&gt;b&lt;/item&gt;'"/>
     </xf:trigger>
     <xf:trigger>
         <xf:label>Outer</xf:label>
         <xf:setnode ref="item" ev:event="DOMActivate" 
outer="'&lt;item&gt;c&lt;/item&gt;'"/>
     </xf:trigger>
   </body>
</html>

Le 16/07/2012 16:32, C. M. Sperberg-McQueen a écrit :
> For what it's worth, I think it would be useful to have a standard way
> to load the result of a transform into an instance.
>
> In case an example helps, the form I was working on this past week
> may serve as a simple use case.  It involves two XSLT processes:
> first, the user loads an XML document and a static stylesheet (the
> 'factory') runs over the user's document and produces a second
> stylesheet (the 'filter'), and then the user can configure the filter by
> changing various default behaviors.  Whey they are done, they can
> save the filter to disk or apply the filter to the user's document.
>
> Since the point of the filter is to produce untagged text for the user
> to feed into text analysis or statistical software that does not understand
> XML (it's sad to think that people still use such software, but I'm told
> they do), there is no particular need to load the XML structure of the
> second transformation result into an instance.  (Initially I used the
> 'text' output method in the transform, but all the browsers I tested
> appear to insist on producing either XML or HTML output from a
> transform, so I switched to the XML output method and wrapped
> the text result in an 'output' element.)
>
> But the result of the first transformation MUST be loaded into an
> instance for the form to serve its purpose; the point of the form is
> to illustrate, for a panel discussion at a conference next week,
> (a) that it's not enough just to 'strip the tags out' of an XML document
> and (b) that it's possible to provide an interface to allow an
> intelligent selection from the encoded document.  So the user
> must be able to edit the filter, which means the filter must be an
> XML instance.
>
> In this case, I handled the lack of 'loadXML' action by using a simple
> trick:  I submit the text result of the initial transformation to a script
> on the server, which does nothing but bounce it back to the client
> as text/xml.  The submission is defined this way:
>
>        <xf:submission id="load-userxslt"
>                    ref="instance('filter')/text()"
>                    method="post"
>                    resource="../../../lib/reflect-as-xml.sh"
>                    replace="instance"
>                    instance="filter"
>                    />
>
> The 'filter' instance initially contains the text-node output from the
> transformation; this submission sends that output (without the
> outermost wrapper element, which is not needed) to the server,
> where 'reflect-as-xml.sh' does nothing but send it back with an HTTP
> header.  Reduced to its essentials, reflect-as-xml.sh looks like this:
>
>    #!/bin/sh
>    echo "Content-Type: text/xml"
>    echo
>    cat
>
> It would be a nicer solution, however, if no server round-trip were
> required here.  (I thought about trying to figure out how to do that
> in Javascript with an extension function or extension action, but I
> decided to go with this quicker solution, for purposes of the demo.)
>
> In case it's of interest to readers of this list, the form in question
> is now visible at
>
>    http://blackmesatech.com/2012/07/dh/sdb.xml
>
> The form is intended as a toy to illustrate some general principles,
> and not as a tool for really serious work.  (So in particular, don't
> give it a very large document to work with.  It works fine on a
> TEI-encoded sonnet, and it takes several minutes [and counting] to
> handle one of Shakespeare's five-act plays.)
>
>



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to