October 31, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Discover the Wonders of XSLT: Workflows

  • June 16, 2004
  • By Benoît Marchal
  • Send Email »
  • More Articles »

result-document

What about the opposite, taking an XML document and splitting it in multiple output documents? There is no solution with XSLT 1.0 but support for multiple output documents will be added in XSLT 2.0.

At the time of writing, the draft XSLT 2.0 proposes the result-document element. Basically, anything that appears within a result-document element is written to a separate file.

<xsl:result-document href="photo-{@id}.html">
   <!-- ... -->
</xsl:result-document>
A word of warning: XSLT 2.0 has not been formally approved at the time of writing, so this feature may still change. Furthermore, chances are your XSLT processor does not implement it (most processors have a proprietary alternative, though). Again, consult your processor documentation if you need this feature.

Exercise

As a final exercise, I encourage you to revisit the previous exercises and update your style sheets to reformat the dates.

So far, dates are displayed in the ISO format: 2004-02-08. By using the substring-before() function, you can reformat it to the more common 02/08/2004 format.

Conclusion

XSLT is a versatile and flexible language. The last five articles have laid down the basics to get you started. Remember that practice makes proficient.

About the Author

Benoît Marchal is a Belgian writer and consultant. He is the author of XML by Example and other XML books.

He is currently developing new training material on UML modelling and XML.





Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel