Jump to content

Can XSLT do this?


shulin

Recommended Posts

Suppose I have an xml file looks like:<components> <component> <name> PC1</name> <property> HP </property> <component> <name> OS </name> <property> WinXP<property> </component> </component> <component> <name> PC2</name> <property> HP </property> <component> <name> OS </name> <property> Linux<property> </component> </component></components>Is it possible to write an XSLT to convert this into 4 HTML files, one for PC1, one for OS on PC1, one for PC2 and one for OS on PC2? That is, each <component> tag maps to an HTML file?Also I would like to organize the file as:components/PC1.htmcomponents/PC1/OS.htmcomponents/PC2.htmcomponents/PC2/OS.htmA sample code is highly appreciated.shu-lin

Link to comment
Share on other sites

In XSLT 1.0 at least, you can't write to multiple documents without the help of extensions (different for every processor).If you're forced to use XSLT 1.0, you may try the exsl:document element which however is only available in libxslt (available with a bundled PECL extension to PHP, natively to C, and with wrappers for other languages).If you can use XSLT 2.0 (regardless of the exact processor), you can use the xsl:document element.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...