Ok a slightly larger challenge.
I have an xml file that list xml docs in it.
I want to merge the xml docs to produce the earlier results.
How do I combine what you have shown me with the below to make it work. I
have not been successful.
My filelist doc.
<?xml version="1.0"?>
<files>
<pagefile>home.xml</pagefile>
<listfiles>lista.xml</listfiles>
<listfiles>listb.xml</listfiles>
</files>
My merge.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>
<xsl:param name="required-lang" select="es-ES"/>
<xsl:template match="/">
<iThink.ePulp>
<xsl:for-each select="files/listfiles">
<xsl:variable name="file"
select="document(text())"/>
<xsl:copy-of
select="$file/iThink.ePulp/child::*"/>
</xsl:for-each>
<xsl:apply-templates/>
</iThink.ePulp>
</xsl:template>
<xsl:template match="files">
<here>
<xsl:for-each select="files/listfiles">
<xsl:variable name="file"
select="document(text())"/>
<xsl:copy-of select="$file/*"/>
</xsl:for-each>
</here>
</xsl:template>
<xsl:template match="*[(_at_)lang='es-ES']">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="node()">
<xsl:if test="not(@lang) or (@lang=$required-lang)">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: Friday, April 16, 2004 1:02 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Select issue with some attr and others not.
Well what I would like to do is set a param and be able to use the param
to
deside what lang is brought back.
ah in an ideal world you would just change my template
<xsl:template match="*[(_at_)lang='es-ES']"/>
to say
<xsl:template match="*[not(@lang=$required-lang)]"/>
and pass required-lang="the queens english"
into the processor.
that would work in xslt2 drafts but unfortunately they banned the use of
variables on match patterns in xslt1 so you can't do that.
So you have to modify the main template not just add another, so now you
only need one template:
<xsl:template match="node()">
<xsl:if test="not(@lang) or (@lang=$required-lang)">
<xsl:copy>
<xsl:copy-of select="@*/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--+------------------------------------------------------------------
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>
--+--