I have an xml file and also an xsl file which I wrote for it to generate html. my xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<expert_questions>
<question Id="10">
<source_ip>192.168.150.1</source_ip>
<port>545</port>
<packet_size>1400</packet_size>
<more_details>
<time>13:42</time>
<count>100</count>
<comment>more details</comment>
</more_details>
</question>
<question Id="...">
.
.
.
</question>
</expert_questions>
and my xsl file:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<xsl:for-each select="expert_questions">
<table border="1" cellspacing="0" cellpadding="0">
<tr class ="table-title">
<th class="th">source ip</th>
<th class="th">port</th>
<th class="th">packet size</th>
<th class="th">more details</th>
</tr>
<xsl:for-each select="question">
<tr>
<xsl:attribute name="id">
<xsl:value-of select="@Id" />
</xsl:attribute>
<td><xsl:value-of select="source_ip"></xsl:value-of></td>
<td><xsl:value-of select="port"></xsl:value-of></td>
<td><xsl:value-of select="packet_size"></xsl:value-of></td>
<td>
<xsl:for-each select="more_details">
<xsl:attribute name="title">
<xsl:value-of select="concat('Time: ', time, ' ')" />
<xsl:value-of select="concat('Count: ', count)" />
<xsl:value-of select="concat('Comment: ', comment)" />
</xsl:attribute>
<xsl:text>more details</xsl:text>
</a>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Information in xml are too long, that should be display in some pages.
I need to use pagination. I searched and I find this page (about Xslt Paging example) to help me do this.
It didn't have any xml files and I can't completely understand what to do (I'm new in xsl).
Can I do this without umbraco or not?
I. Here is a small example showing how to implement "paging"
Given this source XML document:
and given a pagesize of
3
, this XSLT 1.0 transformation:produces:
Do note:
It isn't possible by only using pure XSLT 1.0 to produce more than one result document by a single transformation.
You can either use XSLT 2.0 and its
xsl:result-document
instruction, or an XSLT 1.0 processor that implements EXSLT's<exsl:document>
extension element. Another alternative is to initiate a separate XSLT 1.0 transformation for every output page.II. Paging with XSLT 2.0
When this transformation is applied on the same XML document (above). it successfully creates four result documents.
And Saxon 8.7.01 issues this: