我是XSLT的新手。当窗口的最大尺寸到达时,我有一个问题是将线条分成新行 这是XSLT的结构:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Style RSS so that it is readable. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dns="Service.V1">
<!-- Translated Parameters -->
<!-- Context Parameters, set by calling application, no translation -->
<xsl:template match='/'>
<xsl:apply-templates select='dns:Result'/>
</xsl:template>
<xsl:template match='dns:Result'>
<html>
<head>
<title>
<xsl:value-of select='$PageTitle' />
</title>
<style type="text/css">
.LegendTitle
{
font-family: Verdana;
}
.ReportHeading
{
font-family: Verdana;
font-size: 12pt;
}
.HeaderRight
{
color: black;
font-family: Verdana;
}
.HeaderLeft
{
color: black;
font-family: Verdana;
font-size: 10pt;
line-height: 11pt;
}
.HeaderLabel
{
color: black;
font-family: Verdana;
font-size: 10pt;
line-height: 11pt;
}
.HeaderDataLeft
{
color: black;
font-family: Verdana;
}
.HeaderDataRight
{
color: black;
font-family: Verdana;
}
.MsgColHeaderCenter
{
color: black;
font-family: Verdana;
}
.MsgColHeaderLeft
{
color: black;
font-family: Verdana;
font-weight: bold;
font-size: 10pt;
}
.MsgDataLeft
{
color: black;
font-family: Verdana;
}
.MsgDataCenter
{
color: black;
font-family: Verdana;
font-size: 10pt;
}
.DetailHeader
{
color: black;
}
.DetailData
{
color: black;
}
</style>
</head>
<body width="100%">
<table cellpadding='5' cellspacing='0' width='100%'>
<tr>
<td width='100%' class="ReportHeading">
<xsl:value-of select="$DocumentTitle"/>
</td>
</tr>
</table>
<P/>
<fieldset>
<legend class="LegendTitle">
<xsl:value-of select='$HeaderLabel' />
</legend>
<table cellpadding='0' cellspacing='0' width='100%'>
</table>
<P/>
<table cellpadding='0' cellspacing='0' width='100%'>
</table>
</fieldset>
<P/>
<P/>
<table width='100%' cellpadding='1' cellspacing='0' border='border'>
<tr>
<td valign='bottom' width='150' colspan='2' class="DetailHeader">
<xsl:value-of select="$A"/>
</td>
<xsl:if test ="$ingLimits = 'True'">
<td valign='bottom' width='150' colspan='2' class="DetailHeader">
<xsl:value-of select="$A"/>
</td>
</xsl:if>
<td valign='bottom' class="DetailHeader">
<xsl:text> </xsl:text>
</td>
</tr>
<tr>
<td valign='bottom' width='75' class="DetailHeader">
<xsl:value-of select="$eLabel"/>
</td>
<td valign='bottom' width='75' class="DetailHeader">
<xsl:value-of select="$abel"/>
</td>
<xsl:if test ="$gLimits = 'True'">
<td valign='bottom' width='75' class="DetailHeader">
<xsl:value-of select="$AeLabel"/>
</td>
<td valign='bottom' width='75' class="DetailHeader">
<xsl:value-of select="$LimitsLabel"/>
</td>
</xsl:if>
<td valign='bottom' class="DetailHeader">
<xsl:value-of select="$Label"/>
</td>
</tr>
<xsl:for-each select="dns:List/dns:Information">
<xsl:apply-templates select='.'/>
</xsl:for-each>
</table>
<table id="Footer" border="0" width="95%" style="font-size: 8pt; font-family: Verdana;" align="center" >
<tr>
</tr>
</table >
</body>
</html>
</xsl:template>
<xsl:template match="dns:List/dns:Information">
<tr>
<td valign='top' width='75' class="DetailData">
<xsl:value-of select="dns:dSize"/>
</td>
<td valign='top' width='75' class="DetailData">
<table cellpadding='1' cellspacing='0' width='75'>
<tr >
<td valign='top' width='75' class='DetailData'>
<xsl:value-of select='dns:USL' />
</td>
</tr>
<tr >
<td valign='top' width='75' class='DetailData'>
<xsl:value-of select='dns:SL' />
</td>
</tr>
</table>
</td>
<xsl:if test ="$its = 'True'">
<td valign='top' width='75' class="DetailData">
<xsl:value-of select="dns:Air"/>
</td>
<td valign="top">
<table cellpadding='1' cellspacing='0' width='75'>
<tr >
<td valign='top' width='75' class='DetailData'>
<xsl:value-of select='dns:A' />
</td>
</tr>
<tr >
<td valign='top' width='75' class='DetailData'>
<xsl:value-of select='dns:A' />
</td>
</tr>
</table>
</td>
</xsl:if>
<td valign='top'>
-----------------------
<table cellpadding='1' cellspacing='0'>
<tr>
<xsl:for-each select="dns:ListTop/dns:ListDetail">
<td>
<xsl:apply-templates select='.'/>
</td>
</xsl:for-each>
</tr>
</table>
</td>
</tr>
</xsl:template>
<xsl:template match="dns:ListTop/dns:ListDetail">
<table cellpadding='1' cellspacing='0' width='75'>
<!--<xsl:attribute name="ends-row">true</xsl:attribute>-->
<tr>
<td valign='top' class="DetailData" >
Test222
<xsl:value-of select="dns:Size1"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="*">
<!-- do not process non-matching nodes! -->
</xsl:template>
</xsl:stylesheet>
现在,它们与水平滚动条位于同一行。但是,当我打印此文档时,我无法在打印文档中看到完整的行。所以,我想将这一行拆分为主行中的新行,并显示数据。我希望我很清楚。请提出建议!
以下是我将在一行中获得的输出。每列都附有一行(“dns:ListTop / dns:ListDetail”)。我需要拆分这些列。由于这是与另外一个表和td嵌套,因此它不会分裂!!
答案 0 :(得分:0)
基本策略是使用递归命名模板。将两个参数传递给模板:要输出的内容以及要放入每行的数据量。在模板的正文中,输出第一行,如果还有其他要处理的内容,则对模板进行递归调用,传递要处理的其余内容。