Subject: Re: Off-topic: DOS script for XML directory listing From: Francis Norton <francis@xxxxxxxxxxx> Date: Tue, 29 Feb 2000 20:07:05 +0000 |
Linda van den Brink wrote: > > Could anyone give me a DOS script that can list the URLS of all the (XML) > files in a directory and write them to an XML-formatted output file? > >From the NT online help: "You cannot display a pipe (|) or redirection character (< or > ) when using the echo command." But it is still possible to do this without using anything but DOS, XML and XSLT. I've (lazily) assumed no spaces in file names... Francis. You need the following three files: G:\xmlSchema>type xmlDir.bat @echo off dir *.xml /b > xmlDir.lst saxon xmlDir.xml xmlDir.xsl > xmlFiles.xml G:\xmlSchema>type xmlDir.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE xmlDir [ <!ENTITY xmlDirList SYSTEM "xmlDir.lst"> ]> <xmlDir> &xmlDirList; </xmlDir> G:\xmlSchema>type xmlDir.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- root function --> <xsl:template match="/xmlDir"> <!-- create our root output element --> <xmlDir> <xsl:call-template name="file"> <!-- normalise CRs and line-breaks into single spaces, plus one on the end --> <xsl:with-param name="flist" select="concat(normalize-space(string()),' ')" /> </xsl:call-template> </xmlDir> </xsl:template> <!-- process the idividual files in the space-separated file list --> <xsl:template name="file"> <xsl:param name="flist" /> <xsl:if test="$flist != ''"> <xmlFile><xsl:value-of select="substring-before($flist, ' ')" /></xmlFile> <xsl:call-template name="file"> <xsl:with-param name="flist" select="substring-after($flist, ' ')" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Off-topic: DOS script for XML direc, Linda van den Brink | Thread | RE: Off-topic: DOS script for XML d, Beckers, Marc |
formatting tags, Rakesh Ajmera | Date | Relationship between XSLT and ASP (, John Lam |
Month |