Re: We need something to generate a document from an option or a p:* function

Ok for that I propose two microcomponents

<p:generate-simple-document>
  <p:output port="result" sequence="no"/>
  <p:option name="root" required="yes"/>
  <p:option name="content" />
</p:generate-simple-document>

would generate the document
<root>content</root>

and
<p:add-attribute>
  <p:input port="source" sequence="no"/>
  <p:output port="result" sequence="no"/>
  <p:option name="match" required="yes"/>
  <p:option name="attribute-name" required="yes"/>
  <p:option name="attribute-value" required="yes"/>
</p:add-attribute>



On 7/24/07, Innovimax SARL <innovimax@gmail.com> wrote:
> Dear,
>
> Looking around and around to solve some use case, I arrive to this conclusion
>
> We need something to generate a simple XML document with values inside
> evaluated from the value of options or p:* functions
>
> Some consideration
>
> AVT would help for attributes. Not for content element
>
> We could always do a
> <p:for-each>
>   <p:option name="iteration-count" select="p:iteration-count()"/>
>   :
>   :
>   <p:xslt>
>     <p:parameter name="param" select="$iteration-count"/>
>     <p:input name="stylesheet">
>       <p:inline>
>         <root attr="{$param}" xsl:version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
>       </p:inline>
>     <p:input>
>   </p:xslt>
> </p:for-each>
>
> which is honestly a heavy machinery for that
>
>
> nor p:set-attributes, nor p:insert would help because they all wait
> for a document as input (so the problem is before)
>
>
> Another approach is
>
> <p:for-each>
>   <p:string-replace match="@attr">
>     <p:input port="source">
>      <p:inline>
>        <root attr="FOO"/>
>      </p:inline>
>     </p:input>
>     <p:option name="replace" select="concat('&apos;',
> p:iteration-count(), '&apos;')"/>
>   </p:string-replace>
> </p:for-each>
>
> It is still a bit tricky
>
> Any thoughts on that points ?
>
> Mohamed
>
> --
> Innovimax SARL
> Consulting, Training & XML Development
> 9, impasse des Orteaux
> 75020 Paris
> Tel : +33 9 52 475787
> Fax : +33 1 4356 1746
> http://www.innovimax.fr
> RCS Paris 488.018.631
> SARL au capital de 10.000 €
>


-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 €

Received on Wednesday, 1 August 2007 16:35:25 UTC