我想創建一個索引垂直兩列,每列有50行。Xslt索引垂直兩列(50行)
<span style="font-family:Univers Condensed; font-size:9pt; ">
<xsl:for-each select="//VICINITY[not(. = preceding::VICINITY)]">
<xsl:sort select="." data-type="text" order="ascending"/>
<xsl:sort select="preceding-sibling::ITA_LIGHT_NUMBER" data-type="text" order="ascending"/>
<xsl:variable name ="localita" select="."/>
<xsl:value-of select="."/>
<xsl:text>....................</xsl:text>
<xsl:value-of select="preceding-sibling::ITA_LIGHT_NUMBER"/>
<xsl:for-each select="following::VICINITY[. = $localita][last()]">
<xsl:text> - </xsl:text>
<xsl:value-of select="preceding-sibling::ITA_LIGHT_NUMBER"/>
</xsl:for-each>
<br/>
</xsl:for-each>
</span>
這是我的輸出: - 2666.5
阿恰羅利........... 2665.3
我使用該XSLT創建了一個簡單垂直指數(成一列)
AMENDOLARA .......... 3431.25
ANCONA .............. 3921.9
BRINDISI ............ 3624
CASTELLAMMARE ....... 2573.5
CHIOGGIA ............ 4108
科裏利亞諾CALABRO..3429.2 - 3429.55
FIUME TRIONTO ....... 3427
FRIGOLE ............. 3614.3
GENOVA ......... ..... 1577
不過,我會在兩列的分表垂直指數:(在這個例子中我的表縮短到五排)
<table>
<tr>
<td>ACCIAROLI.....2665.3 - 2666.5</td> <td>CHIOGGIA............4108<br/></td>
</tr>
<tr>
<td>AMENDOLARA......3431.25</td> <td>CORIGLIANO....3429.2-3429.55<br/></td>
</tr>
<tr>
<td>ANCONA............3921.9</td> <td>FIUME TRIONTO.......3427<br/></td>
</tr>
<tr>
<td>BRINDISI...........3624</td> <td>FRIGOLE.............3614.3<br/></td>
</tr>
<tr>
<td>CASTELLAMMARE.....2573.5</td> <td>GENOVA..............1577<br/></td>
</tr>
</table>
這是我的XML:
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>2665.3</ITA_LIGHT_NUMBER>
<VICINITY>ACCIAROLI</VICINITY>
<ITA_LIGHT_NAME>Secca Vecchia</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>2666.5</ITA_LIGHT_NUMBER>
<VICINITY>ACCIAROLI</VICINITY>
<ITA_LIGHT_NAME>Ondametro</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3431.25</ITA_LIGHT_NUMBER>
<VICINITY>AMENDOLARA</VICINITY>
<ITA_LIGHT_NAME>Impianto di itticoltura;Boa "A"</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3921.9</ITA_LIGHT_NUMBER>
<VICINITY>ANCONA</VICINITY>
<ITA_LIGHT_NAME>Installazioni per idrocarburi;BARBARA H</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3624</ITA_LIGHT_NUMBER>
<VICINITY>BRINDISI</VICINITY>
<ITA_LIGHT_NAME>Brindisi-Casale (AERO)</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>2573.5</ITA_LIGHT_NUMBER>
<VICINITY>CASTELLAMMARE DI STABIA</VICINITY>
<ITA_LIGHT_NAME>Impianti di mitilicoltura;Boa SW</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>4108</ITA_LIGHT_NUMBER>
<VICINITY>CHIOGGIA</VICINITY>
<ITA_LIGHT_NAME>Diga N, estr</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3429.2</ITA_LIGHT_NUMBER>
<VICINITY>CORIGLIANO CALABRO</VICINITY>
<ITA_LIGHT_NAME>Ingresso bacino di evoluzione;Molo S, estr</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3429.55</ITA_LIGHT_NUMBER>
<VICINITY>CORIGLIANO CALABRO</VICINITY>
<ITA_LIGHT_NAME>Darsena N.2;Banchina N.4, spigolo S</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3427</ITA_LIGHT_NUMBER>
<VICINITY>FIUME TRIONTO</VICINITY>
<ITA_LIGHT_NAME>Impianto di maricoltura</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>3614.3</ITA_LIGHT_NUMBER>
<VICINITY>FRIGOLE</VICINITY>
<ITA_LIGHT_NAME>Area di protezione e sviluppo delle risorse biologiche marine;Boa B3</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<ITA_LIGHT_NUMBER>1577</ITA_LIGHT_NUMBER>
<VICINITY>GENOVA</VICINITY>
<ITA_LIGHT_NAME>Granarolo</ITA_LIGHT_NAME>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
親愛的蒂姆,這不給2列。謝謝 。 – 2014-12-02 14:02:30
我相信這確實給出了兩欄。我在表格中添加了一個邊框以使其更加清晰。你可以在http://www.xmlplayground.com/NTvfek – 2014-12-02 14:05:56
看到它的行動好吧蒂姆,我錯了在正確的位置輸入代碼。謝謝。 – 2014-12-02 17:01:59