[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to refer to xml elements when using the document() f

Subject: Re: how to refer to xml elements when using the document() function
From: Jiri Jirat <Jiri.Jirat@xxxxxxxxx>
Date: Tue, 28 Nov 2000 08:15:10 +0100
mairal
Hello Teresa,
 try this (works with Saxon):

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
 <xsl:variable name="cmissions"><xsl:value-of select="document
('missions.xml')//missionspage/mission/country_code"/></xsl:variable>

 <xsl:message>
  Variable: <xsl:value-of select="$cmissions"/>
 </xsl:message>

</xsl:template>

</xsl:stylesheet>

To see some functional examples, download
the XPointer or XLink tutorial from our site
and look at the XSLT:
http://www.zvon.org/index.php?nav_id=3

Best regards
Jirka





Teresa.Mairal-Barreu@xxxxxxxxxxx wrote:
> 
> I have been searching for the use of the document() function but I have
> found very little information and in some cases some of the examples didn't
> work when I tried them.
> 
> I have to work with two different xml sources and I've been using document
> () but my question is what syntax to use to refer to individual elements
> belonging to 2 different input sources. I'm using xt and so far the only
> result I get is no result or the whole xml document is pasted into the
> output.
> 
> I have tried:
> 
>  <xsl:variable name="cmissions"><xsl:value-of select="document
> ('../missions/missions.xml',  /)"/></xsl:variable>
> 
>  and then refer to elements in the following way:
> 
> <xsl:value-of select="$cmissions/mission/country_code"/>. This gives me an
> "unable to resolve node-set error".
> 
> I also need to get the contents of <misscity> for each <hom_country> ie
> hom_country_code and hom_country have to be compared and the corresponding
> city has to be part of the output. How do I refer to each hom_country and
> country_code?
> 
> I'd appreciate it if you could help.
> 
> homs.xml
> --------------
> <homs_list>
>    <hom>
>        <hom_type>abc</hom_type>
>        <hom_name>xyz</hom_name>
>        <hom_country_code>fr</hom_country_code>
>    </hom>
>    <hom>
>    .....
>    </hom>
> <homs_list>
> 
> missions.xml
> -------------------
> <missionspage>
>    <mission>
>       <country_code>fr</country_code>
>       <missaddress>
>          <misstreet>xyz</misstreet>
>         <misscity>abc</misscity>
>      </missaddress>
>    </mission>
>    <mission>
>    ...
>    </mission>
> </missionspage>
> 
> Teresa
> 
> _________________________________________
> Teresa Mairal Barreu
> Public Diplomacy Division
> Images of Australia Branch
> International Media Strategies Section
> Australian Department of Foreign Affairs and Trade
> 
> teresa.mairal-barreu@xxxxxxxxxxx
> http://www.dfat.gov.au
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
 <name firstName="Jirka" surname="Jirat"/>
 <mail>     jiratj@xxxxxxxxx  </mail>
 <support>  http://www.zvon.org </support>
 <zvonMailingList> http://www.zvon.org/index.php?nav_id=4
</zvonMailingList>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.