[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: creating list from structured paragraphs

Subject: RE: creating list from structured paragraphs
From: "David Santamauro" <david.santamauro@xxxxxxxx>
Date: Mon, 20 May 2002 07:50:08 -0400
no. 1 list
> This should be quite straightforward, though I have not tested it:
>
> <xsl:template match="para-1">
> <list-item>
> <xsl:value-of select=".">
> </list-item>
> </xsl:template>
>
> <xsl:template match="para">
> <para>
> <xsl:value-of select=".">
> <list>
> <xsl:apply-templates />
> </list>
> </para>
> </xsl:template>

not quite and here are the results with msxsl.exe:

<?xml version="1.0" encoding="UTF-16"?>
 <para>The following text is a list
  List item No. 1
  List item No. 2
  List item No. 3
 <list>The following text is a list
  <list-item>List item No. 1</list-item>
  <list-item>List item No. 2</list-item>
  <list-item>List item No. 3</list-item>
 </list></para>

It seems because 'para' is of mixed content, when you grab its contents with
<xsl:value-of/> you also get all text.

thanks for trying though,

David


>
> The former should work for the first case. For the second case, it may
> be a little bit more complicated. I'd suggest using a xsl:for-each,
> using position() and/or following-sibling and/or something else. As you
> see, I am not an expert ;-)
>
> Antonio Fiol
>
>
> David Santamauro wrote:
>
> >I'm hoping this is simple. Here is the XML:
> >
> ><doc>
> > <para>The following text is a list
> >  <para-1>List item No. 1</para-1>
> >  <para-1>List item No. 2</para-1>
> >  <para-1>List item No. 3</para-1>
> > </para>
> ></doc>
> >
> >I need:
> >
> ><doc>
> > <para>The following text is a list
> >  <list>
> >   <list-item>List item No. 1</list-item>
> >   <list-item>List item No. 2</list-item>
> >   <list-item>List item No. 3</list-item>
> >  </list>
> > </para>
> ></doc>
> >
> >I'd cut and paste my XSL but it doesn't work so I felt it not worth the
> >bandwidth.
> >
> >It should also be noted that I do have influence over the XML to
> an extent.
> >I can remove the parent-child relationship so that the XML looks
> like this:
> >
> ><doc>
> > <para>The following text is a list</para>
> > <para-1>List item No. 1</para-1>
> > <para-1>List item No. 2</para-1>
> > <para-1>List item No. 3</para-1>
> ></doc>
> >
> >but it didn't bring me closer to a solution. Any help would be much
> >appreciated.
> >
> >thanks
> >
> >David
> >
> >
> >
> >
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
> >.
> >
> >
> >
>
>
>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.