This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: divide info in several output files
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] divide info in several output files
- From: cutlass <cutlass at secure0 dot com>
- Date: Thu, 01 Mar 2001 16:35:59 +0000
- References: <004e01c0a268$b14bb080$2a53a8c0@latinia>
- Reply-To: xsl-list at lists dot mulberrytech dot com
> hello everybody;
>
> I don`t know how to face this problem:
>
> one xml file with a long list of items (28 i.e.)
> <whatever>
> <anything>ryur54wrthigyuif</anything>
> <anything>ryureicnsd45gkjuif</anything>
> <anything>ihdftuiwtusd78yrt</anything>
> <anything>..................
> </whatever
there are a few methods for this, i will give you some places to start
(there are certainely better ways, but it sounds like you are just
starting )
A) arrange your xml file in the format ( or break them up ) in the way
you want, with your first stylesheet so the output looks like below and
then parse with a 2nd stylesheet to create your display ( this is a 2
pass solution)
-----------------------------------------------------------------------
xml file 1
<page>
<anything>ryur54wrthigyuif</anything>
<anything>ryureicnsd45gkjuif</anything>
<anything>ihdftuiwtusd78yrt</anything>
<anything>..................</anything>
</page>
xml file 2
<page>
<anything>ryur54wrthigyuif</anything>
<anything>ryureicnsd45gkjuif</anything>
<anything>ihdftuiwtusd78yrt</anything>
<anything>..................</anything>
</page>
-----------------------------------------------------------------------
B) supply your stylesheet with a parameter (u can supply a param to a
stylesheet, depends on which parser u are using, then use test condition
in your
<xsl:apply-templates> to select whatever elements which are greater then
or less then 'start' and 'end' ( remember u cant use < or > use < or
> entities in tests )
xsl
-------------------------------
<xsl:param name="start"></xsl:param>
<xsl:param name="end"></xsl:param>
xml
--------------------------------
<whatever>
<anything n="1">ryur54wrthigyuif</anything>
<anything n="2">ryureicnsd45gkjuif</anything>
<anything n="3">ihdftuiwtusd78yrt</anything>
<anything n="4">..................</anything>
</whatever>
you can use method A ( with one xml output ) by supplying a parameter
to display stylesheet such as <xsl:param name="page"></xsl:param>
<page n="1">
<anything>ryur54wrthigyuif</anything>
<anything>ryureicnsd45gkjuif</anything>
<anything>ihdftuiwtusd78yrt</anything>
<anything>..................</anything>
</page>
<page n="2">
<anything>ryur54wrthigyuif</anything>
<anything>ryureicnsd45gkjuif</anything>
<anything>ihdftuiwtusd78yrt</anything>
<anything>..................</anything>
</page>
once u get it with these examples, there are other xsl techniques using
ID, IDREFs and Keys.
cheers,jim
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list