Subject: Re: [xsl] Batch transform into one file From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 15 Jan 2008 11:32:57 -0500 |
<set> <file>one.xml</file> <file>two.xml</file> <file>three.xml</file> <file>four.xml</file> </set>
<xsl:for-each select="document(/set/file)"> <!-- your context is now the root of each of the documents listed --> <xsl:if test="/wheres/your/@id='W1S'"> <xsl:text>File #</xsl:text> <xsl:copy-of select="/wheres/your/field[@id='4']"/> </xsl:if> </xsl:for-each>
I hope this helps, Wendell
Hi. I need to alter the stylesheet below to create 1 text file with the data extracted from multiple XML files from a batch transform. Right now it will create 1 text file for each XML file transformed.
Background: I receive XML files that I batch transform. These files are from two sources: source 1 is W1L, source 2 is W1S. When I receive these files, they are mixed so I do not know which files are from which source. I want to have the below stylesheet create one text file that will contain a list of all file numbers (File #<xsl:copy-of select="field[@id='4']"/) where the "@id='W1L'", and ignore anything else.
Thanks in advance.
Gary
=========================================================================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="filename"/> <xsl:template match="mimetype"/> <xsl:template match="mimedata"/>
<xsl:template match="AppraisalForm">
<!-- This is file 'Long Form.xsl' -->
<!-- Use this to batch transform XML files and make one file that contains a list of file
names where where "@id='W1L'". If "@id<>'W1L'", then nothing is extracted from that XML
file -->
<!-- Select specific Node or Form based on its id -->
<xsl:if test="@id='W1S'">
File #<xsl:copy-of select="field[@id='4']"/>
</xsl:if>
</xsl:template>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Batch transform into one file, Gary E. Daniels | Thread | Re: [xsl] Batch transform into one , Gary E. Daniels |
[xsl] [Announce] Qizx/db 2.0 Releas, Olivier Ishacian | Date | Re: [xsl] Supressing entity expansi, Mukul Gandhi |
Month |