xsl-list
[Top] [All Lists]

Re: referencing to other xml and xsl files

2003-09-11 11:01:25
Manolis Mavrikis wrote:
Lets say that 1.XML has an xref to 2.XML eg,
eg, <question xref="2">

So then 2.XML has a <title> element the value of which I want to import to
my final HTML when 1.XML is transformed. What should I look for to achieve
that ?

Look for the document() function. For example
  <xsl:template match="question">
    <a href="{(_at_)xref}(_dot_)html">
      <xsl:value-of select="document(concat(@xref,'.xml'),/)/*/title"/>
    </a>
  </xsl:template>

Similarly I may want to "import" the result of the transformation of  the
whole of 2.XML with the same (or a differnet XSL) that I am using to
transform 1.XML.Is something like that possible in XSLT ? Or am I talking
non-sense ?

If the transformed referenced document is XML, and you can assure
it is processed before the document which references it, just use
document() again.
Otherwise, look for frameworks suitable for complex arrangements
of transformations, for example Cocoon
  http://cocoon.apache.org
Note that specifically in Cocoon there are other methods of
aggregating content favored over using document() in XSLT files.

J.Pietschmann



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list