xsl-list
[Top] [All Lists]

Re: Re: Partial Extraction

2003-02-05 04:43:52
Hi Frank,

Is there a method in XSLT where I can transform only one section of
<group> and upon pressing a "previous" or "next" button make a
transformation of the next or previous <group> section. I only need
to display one group at a time the reason being that each group can
be large.

You have several options here.

The first option would be to split up your file, perhaps in a
pre-processing step, into several different documents each holding one
group. That way the XSLT transformation can focus on one group at a
time. If you need information from the context in which the group is
found, then you can incorporate that information during the process of
splitting up the file. This approach has the advantage that you can do
the splitting up statically and then only have to transform each group
on-demand. The next and previous buttons would just be links to the
split-up files (with some transformation performed on them).

The second option is similar to the first, except that you go the
whole hog during the splitting-up process, and create the transformed
result. The next and previous buttons would be links to the results of
the transformations of the next and previous group.

The third option is to use a parameter passed into the stylesheet to
determine which group is viewed at a particular time. The next and
previous buttons would be buttons that invoke a transformation on the
data with a different parameter value (you have to script this). If
you choose this option, you need a stylesheet that declares a
parameter and uses that to pick the group to transform. Something
like:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:param name="group" select="1" />

<xsl:template match="total">
  <xsl:apply-templates select="group[position() = $group]" />
</xsl:template>
...
</xsl:stylesheet>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>