This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Can Lotus XSL Parser output to multiple files?


If anyone can help me with this, I will really appliciate it. I am using "lotusxsl_0_18_5" parser's "java com.lotus.xsl.Process" from command line to output to html files. What I want to achieve is that when walking down the <TempFIle> node, output to a file named "&filename;" entity. Since this XML contains 2 <TempFile> node whose name are "login" and "registration", I want to create "login.html" and "registration.html". But "java com.lotus.xsl.Process" accept only -in, -out, -xsl as parameters and they are 1 to 1 relationship, so basically you need 1 xsl file to create 1 html output. I want to use 1 xsl, 1 xml to create multiple number of output files. As you see below, the only difference between "login.xsl" and "registration. xsl" is their "filename" entity, does anyone know how I can avoid this duplicate code? This is what I am doing now..... $ java com.lotus.xsl.Process -in this.xml -xsl login.xsl -out login.html $ java com.lotus.xsl.Process -in this.xml -xsl registration.xsl -out registration.html --------------- My xml file looks like this ... -------------------------- <Templates> <GlobalInfo> <Color> <BgColor>#ffffff</BgColor> </Color> </GlobalInfo> <TempFiles> <File name="login"> <Title>Login</Title> <Body>This is body text</Body> </File> <File name="registration"> <Title>registration</Title> <Body>This is body text</Body> </File> </TempFiles> </Templates> ----------------- globalinfo.xsl, which is included in other xsl files ----------------------------- <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform/" xmlns="http://www.w3.org/TR/REC-html40"> <xsl:output method="html" indent="yes" encoding="Shift_JIS"/> <xsl:template name="title"> <xsl:value-of select="$doctitle"/> </xsl:template> <xsl:template name="presentationWindow"> <xsl:value-of disable-output-escaping="yes" select="$body"/> </xsl:template> <xsl:template name="power"> <HTML> <HEAD> <TITLE> <xsl:call-template name="title"/> </TITLE> </HEAD> <BODY> <xsl:attribute name="bgcolor"> <xsl:value-of select="Templates/GlobalInfo/Color/BgColor"/> </xsl:attribute> <xsl:call-template name="presentationWindow"/> </BODY> </HTML> </xsl:template> </xsl:stylesheet> --------------------------- login.xsl file.... --------------------------- <?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY filename "login"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40"> <xsl:include href="globalinfo.xsl"/> <xsl:template match="/"> <xsl:variable name="body" select="Templates/TempFiles/File[@name='&filename;']/Body"/> <xsl:variable name="doctitle" select="Templates/TempFiles/File@name='&filename;']/Title"/> <xsl:call-template name="power"/> </xsl:template> </xsl:stylesheet> ------------ registration.xsl file.... ------------ <?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY filename "registration"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40"> <xsl:include href="globalinfo.xsl"/> <xsl:template match="/"> <xsl:variable name="body" select="Templates/TempFiles/File[@name='&filename;']/Body"/> <xsl:variable name="doctitle" select="Templates/TempFiles/File@name='&filename;']/Title"/> <xsl:call-template name="power"/> </xsl:template> </xsl:stylesheet> --------------------------------- Kaoru Omiya Software Developer Linc Media, Inc. Okakyu Minami-Aoyama Building 10F 7-8-1 Minami-Aoyama Minato-ku, Tokyo 107-0062 Japan Web: www.lincmedia.co.jp Ph. 03-3499-3099 Fax: 03-3499-2199 Direct. +81-3-3499-2175 Ext. 1454 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]