xsl-list
[Top] [All Lists]

Re: [xsl] Applying external XML

2010-02-02 13:01:03
Try to use absolute paths in menu.xml or do something like:

<xsl:for-each select="item-uri">
  <xsl:variable name="fileName" select="normalize-space(.)"/>
  <xsl:variable name="infile"
select="concat('file:///',$infilepathname, '/', $fileName)" />
  <xsl:apply-templates select="doc($infile)"/>
</xsl:for-each>

Israel

On Tue, Feb 2, 2010 at 8:29 PM, Rob Belics <rob_belics(_at_)charter(_dot_)net> 
wrote:

I'm trying to import xml data from other files on a remote server and
apply templates to that data. Everything in my "restaurant.xsl" works
and I've retrieved "menu.xml" which contains links (item-uri) to other
xml files (item.xml) that contain more info about each item for sale on
the menu (tuna and roast beef). However, I'm having problems trying to
import the item.xml data.

I tried <xsl:apply-templates select="document()" /> in between the
'for-each' with various combinations of xpath for the document() but
that hasn't gotten results I need.

restaurant.xsl:
<xsl:template match="menu">
       <menu>
               <xsl:for-each select="item-uri">
<!-- What goes here? Should I be using 'for-each'? -->
               </xsl:for-each>
       </menu>
</xsl:template>

menu.xml:
<menu>
       <item-uri>tuna.xml</item-uri>
       <item-uri>roast-beef.xml</item-uri>
</menu>

item.xml:
<order>
               <size>
                       <name>Tuna</name>
                       <price>5.00</price>
               </size>
</order>




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>