[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Processing on both a document list and referenced doc
Hi, I have a set of XML documents and a document list that describes the directory structure. What I'd like to do is produce output that displays each folder name in the document list, followed by data merged from the files listed under each folder. Sample input file: file1: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd"> <topic id = "topicA"> <title>TitleA</title> <topic id = "topicB"> <title>TitleB</title> </topic> <topic id = "topicC"> <title>TitleC</title> </topic> </topic> Directory list: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hdlg:filesystem SYSTEM "http://www.hdlg.info/XML/filesystem.dtd"> <hdlg:filesystem xmlns:hdlg="http://www.hdlg.info/XML/filesystem"> <hdlg:folder name="folder1" url="file:/C:/folder1/"/> <hdlg:folder name="folder2" url="file:/C:/folder2/"> <hdlg:file name="file1.xml" size="14155" type="unknown" url="file:/C:/folder2/file1.xml"/> <hdlg:file name="file2.xml" size="132255" type="unknown" url="file:/C:/folder2/file2.xml"/> </hdlg:folder> <hdlg:folder name="folder3" url="file:/C:/folder3/"> <hdlg:file name="file1.xml" size="2455" type="unknown" url="file:/C:/folder3/file3.xml"/> <hdlg:file name="file2.xml" size="4355" type="unknown" url="file:/C:/folder3/file4.xml"/> </hdlg:folder> </hdlg:filesystem> Desired output: <html> <body> <ul> <li xmlns:hdlg="http://www.hdlg.info/XML/filesystem">file:/C:/folder1/> <li xmlns:hdlg="http://www.hdlg.info/XML/filesystem">file:/C:/folder2> <ul> <li>topicA <ul> <li>topicB</li> <li>topicC</li> </ul> </li> </ul> <ul> .. </ul> <li xmlns:hdlg="http://www.hdlg.info/XML/filesystem">file:/C:/folder3> .. </ul> </body> </html> My current XSL transformation displays each folder name in a bulleted list, as desired. But the output includes the entire set of topic/title values beneath each folder name. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <xsl:variable name="files" select="document('file:///c:/sabadoc/output/files2.xml')"/> <html> <body> <ul> <xsl:for-each select="$files//hdlg:folder/@url" xmlns:hdlg="http://www.hdlg.info/XML/filesystem"> <li> <xsl:value-of select="."/> <xsl:for-each select="document($files//hdlg:file/@url)" xmlns:hdlg="http://www.hdlg.info/XML/filesystem"> <ul> <xsl:for-each select="topic"> <li> <xsl:value-of select="title"/> <ul> <xsl:for-each select="topic"> <li> <xsl:value-of select="title"/> <ul> <xsl:for-each select="topic"> <li> <xsl:value-of select="title"/> </li> </xsl:for-each> </ul> </li> </xsl:for-each> </ul> </li> </xsl:for-each> </ul> </xsl:for-each> </li> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet> Is it possible to produce output based on the contents of both the directory list and the documents referenced by the directory list? Thanks, Mark -- Mark Peters Senior Technical Writer Saba Software
|
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
|