[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: bat file creation based on xsl /xml
It's not entirely clear what you're trying to achieve. Are you looking for a batch file that will invoke the XSLT? Or are you trying to *generate* a batch file? You must be using Saxon since you are using Saxon's collection extensions. If so, if you are using newest saxon you can use XSLT 3 and get the collection information as a map with metadata about the files as well as access to the file contents. See http://www.saxonica.com/documentation/index.html#!sourcedocs/collections for details. Here's a style sheet to report the metadata for a directory (I just ran it on the stylesheet itself as the input doc): <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:map="http://www.w3.org/2005/xpath-functions/map" expand-text="yes" exclude-result-prefixes="xs map" version="3.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <xsl:variable name="directory" select="tokenize(document-uri(.), '/')[position() lt last()] => string-join('/')" as="xs:string"/> <xsl:message>Getting directory information for directory "{$directory}"</xsl:message> <xsl:variable name="file-metadata" as="map(*)*" select="collection($directory || '?recurse=yes;metadata=yes;match=.+')" /> <dir-listing count="{count($file-metadata)}"> <xsl:for-each select="$file-metadata"> <xsl:variable name="map" as="map(*)" select="."/> <file> <xsl:for-each select="map:keys($map)" > <xsl:variable name="key" select="."/> <xsl:choose> <xsl:when test="$key = ('fetch')"> <!-- do nothing --> </xsl:when> <xsl:otherwise> <item key="{$key}">{$map?($key)}</item> </xsl:otherwise> </xsl:choose> </xsl:for-each> </file> </xsl:for-each> </dir-listing> </xsl:template> </xsl:stylesheet> Cheers, E. -- Eliot Kimber http://contrext.com o;?On 1/15/19, 11:56 AM, "Rahul Singh rahulsinghindia15@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: I have a one xsl code as given below to invoke and get result, once the command is fired the application starts and will get result immediate in notepad: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xs fn"> <xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/> <xsl:template match="/"> <xsl:for-each select="collection('.?select=*.xml')"> <xsl:text> </xsl:text> <xsl:value-of select="document-uri(.)"/> </xsl:variable> </xsl:for-each> </xsl:template> </xsl:stylesheet> I want to convert that command into the .bat file, so that on clicking .bat file, my application should invoke. Our Input is in one directory. xsl code is in same directory. Thanks, XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/1278982> (by email <>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|