<document> <title>Title Text</title> <para>Paragraph Text</para> </document>There was a whole body of xslt dealing with this (I'm talking thousands of lines of code here, it's really much more complicated than my stupid example leads to believe). Now the dtd has been extended and the xml looks as follows:
<document>
<title>
<container1>
<container2>
<block attr="1">Title Text for a</block>
<block attr="2">Title Text for b</block>
</container2>
</container1>
</title>
<para>
<container1>
<container2>
<block attr="1">Paragraph Text for a</block>
<block attr="2">Paragraph Text for b</block>
</container2>
</container1>
</para>
</document>
The idea is to now generate 2 html documents, one for case a and one for case b. So the whole body of xslt dealing with this document still applies, only I need to import an additional xslt file that tells the original xslt to ignore <container1> and <container2> and <block attr="1|2"> and then proceed as usual. But how? I've only hacked a bit of xslt up till now, so while I know how it works I don't actually have a solid base to work from.You are not logged in, either login or create an account to post comments
If your document is really this flat, and every element has the child elements exactly as you've listed them, I think you'll have to write two new XSLT documents. They will have similar functionality, but one will out put case a and one will out put case b. What you'd want here is XSLTa strips the container1, container2 and block elements, but keeps the contents of block attr="1". XSLTb would do the same, except that it would keep the contents of block attr="2".
So, in the end, you'd transform your newly structured XML document into two documents that have the old structure, then you'd transform each of those documents with your original XSLT.
posted by syzygy at 7:45 AM on April 23