Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Multiple source documents (3/4) >

Reading external document using doc function

External document can be also read using doc() function. Function doc-available() tests for existence of a document on the specified address.
XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <xxx>
                        <available-1>
                              <xsl:value-of  select="doc-available('ext3.xml')"/>
                        </available-1>
                        <available-2>
                              <xsl:value-of  select="doc-available('XYZ.xml')"/>
                        </available-2>
                        <xsl:copy-of  select="doc('ext3.xml')/rrr"/>
                  </xxx>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>

ext3.xml

      <rrr>
            <ccc  y="222"/>
      </rrr>
Output

      <xxx>
            <available-1>true</available-1>
            <available-2>false</available-2>
            <rrr>
                  <ccc  y="222"/>
            </rrr>
      </xxx>


Previous chapter: Groups
Next chapter: Multiple stylesheets
Previous page: Addressing in external documents
Next page: Reading external document with non-XML text

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks