EXSLT - res:document - Use Case 1

Category: example
XML Definition: res.document.xml
Function or Template: function

Use Case

Source (view)

<doc>
   <result-from uri="http://www.example.org/" />
   <result-from uri="data.xml" />
   <p>Note that "data.xml" refers to this document.</p>
   <result-from uri="http://www.microsoft.com/license/GPL" />
</doc>

Stylesheet (view)

<xsl:template match="/doc">
   <output>
      <xsl:copy-of select="res:document(result-from[1]/@uri)" />
      <xsl:copy-of select="res:document(result-from[2]/@uri)" />
      <xsl:copy-of select="res:document(result-from[3]/@uri)" />
   </output>
</xsl:template>

Result (view)

<output xmlns:result="http://exslt.org/resource/result">
   <result:error uri="http://www.example.org/"
                 attempt="1">
      <result:uri>http://www.example.org/</result:uri>
      <result:failed>
         <result:category>connection</result:category>
      </result:failed>
      <result:message>Connection refused</result:message>
   </result:error>
   <result:success uri="file:///some/path/to/data.xml"
                   attempt="1">
      <doc>
         <result-from uri="http://www.example.org/" />
         <result-from uri="data.xml" />
         <p>Note that "data.xml" refers to this document.</p>
         <result-from uri="http://www.microsoft.com/license/GPL" />
      </doc>
   </result:success>
   <result:error uri="http://www.microsoft.com/license/GPL"
                 attempt="1">
      <result:failed>
         <result:category>protocol</result:category>
         <result:item>http</result:item>
      </result:failed>
      <result:code>404</result:code>
      <result:message>Not Found</result:message>
   </result:error>
</output>

Change History

Submitted: 2006-02-22
Creator: John L. Clark(http://infinitesque.net/)

Fetches status-encapsulated documents by URI.

Copyright

http://www.exslt.org/res/functions/document/res.document.use-case.1.html last modified 2006-02-22