Solved

Is there a simple way to justify a list-item (both the list-item-label and list-item-body) with XSL?

Posted on 2006-06-29
7
270 Views
Last Modified: 2006-11-18
In a web application, a user is allowed to use a Word-like text editor to write portions of a document.  The HTML output of this editor is rendered into a PDF using XSL.  There is a requirement to allow arbitrary horizontal alignment (left/start, center, and right/end) at the line item level (that is, not simply at the list level) for bulleted or numbered lists.  Here are a few examples of possible "valid" (but naturally in poor design taste) lists.  Note that each set of three items represents a completely different list.

1. item
2. item
3. item
                              * item
                              * item
                              * item
                                                            1. item
                                                            2. item
                                                            3. item
1. item
                              2. item
                                                            3. item
                                                            * item
                              * item
* item
etc.

However, when we attempt to format the HTML, the best we can get is something like:
1. item
2.                              item
3.                                                            item
0
Comment
Question by:dfu23
  • 3
7 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17016070
Hi dfu23,

can you not just left allign the items in lists using CSS?

Cheers!
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17018649


When you generate your HTML, use an in-line style sheet

<HTML>
<HEAD>
<STYLE TYPE="text/css">
  LI { font-size: large; color: black }
  LI.LEFT { font-size: large; text-align: left;  color: black; }
  LI.RIGHT { font-size: large; text-align: right;  color: black; }
  LI.CENTER { font-size: large; text-align: center;  color: black; }
</STYLE>
<HEAD>

<BODY>

<OL>
  <LI class="LEFT">some Text</LI>
  <LI class="RIGHT">more text</LI>
</OL>

</BODY>
</HTML>


This will produce:
 
   1. some text
   2.              more text


0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17018683


You may also be interested in the list-style-position, margin-left, text-indent or padding-left

Here's  site to help you decide which style is best for you.
http://www.zvon.org/xxl/css1Reference/Output/index.html
0
 
LVL 14

Author Comment

by:dfu23
ID: 17077139
TAD,

If you look at my original question again, we are able to get the lists formatted as you describe.  However, we want the bullet/number to match the alignment of the text itself.  That is, either both are to the left, centered, or to the right.  Having the text to the left, centered, or to the right while the bullet/number is always to the left is not what we're looking for.

Any other ideas?
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 250 total points
ID: 17080879
Here.... This does what you need.  






<HTML>
<HEAD>
<STYLE TYPE="text/css">
  LI { font-size: large; color: black }
  LI.LEFT { font-size: large; text-align: left;  color: black; }
  LI.RIGHT { font-size: large; text-align: right;  color: black; }
  LI.CENTER { font-size: large; text-align: center;  color: black; }
</STYLE>
<HEAD>

<BODY>

<Table>
   <TR>
     <TD Width=500>   <!-- This number changes the relative spacing -->
        <OL>
           <LI class="LEFT">some Text</LI>
           <LI class="center">other Text</LI>
           <LI class="RIGHT">more text</LI>
        </OL>
     </TD>
   </TR>
</Table>
</BODY>
</HTML>
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JPA XML tag definition 2 67
Extract XML Data from using TSQL 5 53
XSLT Help 12 32
XSLT -  replace invalid xml characters 15 32
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question