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]
Other format: [Raw text]

Re: converting to an <ol>


The following is your solution
1. create a File in your system called entityref.dtd and define all the entities you want to use in that( in your specific case you may want to use the space. this would eleminate your definition of entities in the XSL Code)
so your file would have a definition of space
<!ENTITY space "&#160;" ><!-- space -->
2. now refer to this file in your doctype definition of your XSL file

The following is the XSL Code

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet SYSTEM "d:\entityref.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:for-each select="//seqlist/item">
<xsl:for-each select="ancestor::seqlist"> <!--to count the no of spaces -->
<xsl:if test="not(position() = 1)">
<!-- This is to make sure that the first parent set of elements starts without space and the subsequent children wil have space based on the positiuon of the element.. that is.. if it is 3rd child you have NoOfSpaces*3 no of spaces.. where noOfSpaces is the indent length unit . here will have 12 spaces as one Indent Unit -->
&space;&space;&space;&space;&space;&space;&space;&space;&space;&space;&space;&space;
</xsl:if>
</xsl:for-each>
<xsl:number count="item" format="1" level="multiple"/><xsl:value-of select="text()"/><br></br>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I have tested this with XALAN . and it works.

HOPE THIS HELPS
Vasu

From: "Roman Huditsch" <roman.huditsch@hico.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: <xsl-list@lists.mulberrytech.com>
Subject: [xsl] converting to an <ol> Date: Fri, 14 Jun 2002 11:05:00 +0200

Hello,

I came up with a problem, which I hope to be able to solve with your help.

I have the following code fragment:

<seqlist>
<item>Africa</item>
<item>Europe
<seqlist>
<item>Italy</item>
<item>England
<seqlist>
<item>Lonodon</item>
<item>Oxford</item>
</seqlist>
</item>
</seqlist>
</item>
</seqlist>

I would like to get the following HTML output via an XSL Stylesheet:

1. Africa
2. Europe
2.1 Italy
2.2 England
2.2.1 London
2.2.2 Oxford

I tried some transformations, but all I could get was:

1. Africa
2. Europe
1. Italy
2. England
1. London
2. Oxford

I also tried just to put an additional number before the list items, but the result wasn't really satisfying.
Do you have any suggestions?

wbr,
Roman Huditsch

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



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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]