Re: [xsl] Building complex, hierarchical html datasets

Subject: Re: [xsl] Building complex, hierarchical html datasets
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 18 May 2009 14:54:36 +0100
Not sure what help can be offered without a bit more context (eg a small
irregular input and some indication of how you want it chunked into
files)

> Therefore structure is very difficult to predict and producing a
> routine for every variation that does (or could) exist would be very
> arduous and probably unreliable.

It's a basic feature of the design of XSLt that it should be able to
cope with such irregular input. match="law"  matches law elements
wherever they are, you don't need to know in advance all the possible
paths that are needed to reach such an element.

That said your chunking probably does depend on the position of the
element within a document, but its hard to offer any coding advice at
this generality.

something as simple as

<xsl:template match="law">
 <xsl:result-document...
    usually law elements end up as their own file
    <xsl:apply-templates/>
 </xsl:result-document>
 </xsl:template>

<xsl:template match="*/*/*/*/law" priority="2">
 but deeply nested law elements are inlined into their 
parent document    usually law elements end up as their own file
    <div>
    <xsl:apply-templates/>
    </div>
 </xsl:template>

is probably too simple, but the idea is basically sound you just need to
codify some property that determines whether an element is chunked into
its own file a simple count on depth is most likely too simple, but
perhaps depth, and the parent element and an attribute or two might be
enough? 

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread