Using XInclude with XSLT Transformations

On Thu, May 18 2000 Jonathan Marsh wrote:
| The original goal was for XInclude to be transparent. 
| Your comment fuels my suspicion that this may not be the
| best direction.

I also concur with Eric van der Vlist's post [1] -- having 
XInclude information available to XSLT would indeed
be a very large improvement.   Following is a straw-man 
suggestion for allowing tighter XSLT integration without 
requiring a modification to XPath.

Suggestion:  Only apply the "inclusion" process when
             the destination element is <empty/>, etc.

This suggestion creates a fixed-point so that the 
inclusion process applied to the same text
a second time will be a no-op.

...

source.xml

  <foo>
    <bar xinclude:href="include.xml#xptr(b)" one="1" />
  </foo>

include.xml
  
  <a>
    <b two="2" one="3" >
      some <br/> content
    </b>
  </a>

  ==> Apply "inclusion" process to source.xml


result.xml

  <foo>
    <bar xinclude:href="include.xml#xptr(b)" one="1" two="2" >
      some <br> content
    </bar>
  </foo>     


  ==> Apply "inclusion" process to result.xml to make result2.xml

result2.xml

  <foo>
    <bar xinclude:href="include.xml#xptr(b)" one="1" two="2" >
      some <br> content
    </bar>
  </foo>


...

This slightly-different behavior makes allows the include 
specification to work othogonally with other specifications
without change...

...

The primary problem as I see it is, how does one deal with
attributes?  

An obvious solution is to copy over attributes that
do not already have values -- think inheritance.
However, this may cause questions for XSLT as to which
attributes were copied and which were already specified.

This quirk can be overcome if the xlink process somehow
preserves this information, perhaps by appending an
additional attribute detailing which attributes were copied.

  <foo>
    <bar xinclude:href="include.xml#xptr(b)" one="1" two="2" 
         xinclude:copied="two" >
      some <br> content 
    </bar>
  </foo>


Hope this helps,

Clark Evans


References:
[1] http://lists.w3.org/Archives/Public/www-xml-xinclude-comments/2000May/0001.html

P.S.  IMHO, if XInclude is going to use attributes, then it 
      should not be "replacing" the enclosing element.  This
      just hits me as wrong for some reason, but it leads 
      nicely into the above formulation instead...

      Keep up the wonderful progress.

Received on Tuesday, 18 July 2000 14:36:48 UTC