XSL HTML output based on content

yaasss

New Member
I need help with the following task:I already export an Excel-Spreadsheet via VB to XML and within thesame macro I call the XSLT-Processor Saxon via command line to take my xsl-fileand create HTML-webpages from the single xml file.A table is part of the html page and needs to be modified for my task.Path and file names of xsl and xml are being held in variables.This works fine with a single button click - the way I've set everything up.Now the Excel-Spreadsheet has changed in a way that two columns of the whole sheet have been translated into two more languages, everything else remained the same. So I have four more columns in my sheet.Example-OLD: \[code\]|ID|...|LanguageInfo|LanguageDescription|....|\[/code\]Example-NEW:\[code\]|ID|...|1LanguageInfo|1LanguageDescription||2LanguageInfo|2LanguageDescription|3LanguageInfo|3LanguageDescription|...\[/code\]translated to my real sheet: \[code\]|ID|...|GermanInfo|GermanDescription||EnglishInfo|EnglishDescription|ChineseInfo|ChineseDescription|...\[/code\]For each ID a new HTML-page is created. That works for Example-OLD.Now each language needs to get its own html-page, so that one ID will have three language versions, ideally lying in an appropriate directory structure.Like so:Directory "Languages": \[code\] -> German -> id1.html, id2.html,... -> English -> id1.html, id2.html,... -> French -> id1.html, id2.html,...\[/code\]Questions that arise:Can this be done with one XML and one XSL file?Since only four elements or attributes (depending on the structure) need to be added - creating three XML-files seems a bit redundant. Consider the following xml-structure: Where "basis" means: "split this element with its children to one html-page".I believe it shouldn't matter much whether I put the language part in attriubtes or elements so I went for attributes here.\[code\] <root> <basis id="1"> ... <table> ... <languages> <info germanInfo="mein Text" englishInfo="my text" frenchInfo="mon text" /> <description germanDescription="mein Text" englishDescription="my text" frenchDescription="mon text" /> </languages> ... </table> ... </basis> <basis id="2"> .... </basis> ... </root>\[/code\]The following HTML-structure is needed:\[code\] <html> <body> ... <h1>German Webpage for basis with ID="1" </h1> <table> <th>Numbering</th> <th>German Info</th> <th>German Description</th> <th>more columns</th> ... </table> ... </body> </html> \[/code\]And of course the same page two more times for the other two languages.Can I create this with one XML and one XSL file?Or should I create three XML-files one for each language instead? And can one XSL-file handle this in my macro?At the moment my xsl has the following output structure:\[code\]<xsl:result-document href="http://stackoverflow.com/questions/11098260/basis{$id}someotherelement{@nr}.html" > <html>... <body>... <xsl:call-template name="basis" /> ... </body> </html> </xsl:result-document>\[/code\]So no tricky selection of table elements is needed for the old structure.In the end I want the html creation process to run automatically with a single click like I have it working now with only one language.Hope I was able to get my mission accross.Thanks.
 
Back
Top