[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Applying external XML


Subject: Re: [xsl] Applying external XML
From: Israel Viente <israel.viente@xxxxxxxxx>
Date: Tue, 2 Feb 2010 20:40:07 +0200

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@xxxxxxxxxxx> 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>


Current Thread
Keywords