Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Newbie: XSLT: How do pull in info from another XML file? [Thread Next] Re: Newbie: XSLT: How do pull in info from another XML file?To: NULL Date: 5/15/2009 12:11:00 PM lister wrote: > I am playing with XSLT to transform an XML file to HTML for rendering. > I would like to pull in information from another lookup XML file but I > can't find out how to address it in the stylesheet. XPath always seems > to refer to the current file. In XSLT 1.0 you can use the 'document' function which is powerful but as its easiest is used as e.g. document('file.xml') See http://www.w3.org/TR/xslt#document With XSLT and XPath 2.0 there is also the 'doc' function, see http://www.w3.org/TR/xpath-functions/#func-doc Note also that XSLT allows you to pack data into the stylesheet e.g. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:data="http://example.com/2009/mydata" exclude-result-prefixes="data"> <data:data> <lookup> <map key="01" value="January"/> <map key="02" value="February"/> ... </lookup> </data:data> <xsl:variable name="map" select="document('')/*/data:data/loopup/map"/> </xsl:stylesheet> but separating it into a second document is of course possible. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
