Re: XSLT use cases; data-centric to document-centric
- Does anybody agree/disagree to my classification?
Ok, I agree with you upon this.
I wanted to say, when I look at the code which is produced by WYSIWYG editors, they are mostly imperative.
- How can I handle use case 3)? To my mind it would be best to convert a data-centric XML into a well structured documen-centric XML and then apply a XSLT stylesheet.
Well, the thing I have in mind is maybe a little more complex.
I have a data-centric XML, for example an XML representing some ordered products:
<orderedProducts> <product> <name>product A</name> <price>120</price> <quantity>2</quantity> </product> <product> <name>product B</name> <price>90</price> <quantity>1</quantity> </product> </orderedProducts>
Now I want to transform this XML into an FO-document which represents an invoice. The WYSIWYG-tools I know, create one big template containing all the static text someone inputs (the logo and the name of the company, the address, the text before and after the product-list) and of course the instruction which converts the product-xml into a table.
So these tools are more about generating XSL-FO than about creating XSLT. My proposed answer to this is, that it might be better to store all this static text in a separate document:
<document> <header>the logo, the company name</header> <body> <p>Some text what this is about</p> <table>...</table> <!-- here comes the table with the products --> <p>And maybe some text again.</p> </body> </document>
.. and then apply a XSLT which transforms the document- and the orderedProducts-XML into an FO-document.
Sorry, that this example turns out to be a very domain specific problem. I tried - unsuccessful - to generalize it. ;)
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