This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: divide info in several output files


> 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 &lt or 
&gt 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]