[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: document(lang_*.xml)?
Lainaus David Carlisle <davidc@xxxxxxxxx>: | | > Any ideas how to do it...... | | If you have an xml file that has the filenames as nodes then it is easy, | eg | | <x> | <f>lang_en.xml</f> | <f>lang_de.xml</f> | <f>lang_fr.xml</f> | </x> | | then | <xsl:for-each select="document(x/f)/Language/@id"> | | will get all the id attributes from all the files. | | If you don't have such an xml file your system may have an extension to | access directory listings as xml or just do it from the command line | | | | ls *.xml | sed -e "s@\(.*xml\)@<f>\1xml</f>@" | | would for example put <f> </f> around the filename of every xml file in | the current directory given a suitable command line (unix or cygwin bash | on windows for example) Ok. This is what I tried: <snip> #!/bin/sh # this skript reads the directory and selects all lang_*.xml files. # from them it generates list.xml file to be used by profiler.xsl path=/var/www/xslt cd $path /bin/echo "" /bin/echo "Creating backup of previous list.xml file to bu_list.xml file" # copying the file cp $path/list.xml $path/bu_list.xml /bin/echo "Starting lang_list Listing" /bin/echo "" /bin/echo "List of languages in the file list.xml:" /bin/echo "********************************" # printing list to terminal ls lang_*.xml | sed -e "s@\(.*xml\)@<language>\1</language>@" /bin/echo "********************************" # storing data to file ls lang_*.xml | sed -e "s@\(.*xml\)@<language>\1</language>@" > list.xml /bin/echo "Stopping lang_list Listing" # used for developing only, remove when ready emacs $path/list.xml lang_list </snip> The result though is not what was wanted: <language>lang_en.xml</language> <language>lang_fi.xml</language> <language>lang_no.xml</language> <language>lang_se.xml</language> So there is no root level element, how do I add it there? Desired resulttree: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <LangList> <language>lang_en.xml</language> <language>lang_fi.xml</language> <language>lang_no.xml</language> <language>lang_se.xml</language> </LangList> Cheers, Jarkko *************************************************** * Jarkko Moilanen * * Project Researcher, ITCM (www.itcm.org) * * Profound XML technology Expert * * University of Tampere * * Hypermedia Laboratory * *************************************************** XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|