paragraph style problem

Subject: paragraph style problem
From: "ravi akireddy" <ravi@xxxxxxxxx>
Date: Wed, 2 Feb 2000 17:35:29 -0500
I am trying to write stylesheet to output html based on xml file which looks
like the below for paragraph bulleting and indenting

<?xml version="1.0"?>
<testParagraph >
<columnText>
<paragraph style="Normal" leftIndent="18" listType="wdListBullet"
listLevelNumber="1" listString="?" listValue="1" listNumber="1">first
wdbulleted(UL) para</paragraph>
<paragraph style="Normal" leftIndent="18" listType="wdListBullet"
listLevelNumber="1" listString="?" listValue="2" listNumber="1">second
bulleted(UL) para</paragraph>
<paragraph style="Normal" leftIndent="18" listType="wdListBullet"
listLevelNumber="2" listString="?" listValue="1" listNumber="1">first
buleted(UL) para in second level</paragraph>
<paragraph style="Normal" leftIndent="18" listType="wdOutlineNumbering"
listLevelNumber="1" listString="1." listValue="1" listNumber="1">first
buleted(OL) para in first level</paragraph>
<paragraph style="Normal" leftIndent="18" listType="wdOutlineNumbering"
listLevelNumber="1" listString="2." listValue="2" listNumber="1">first
buleted(OL) para in first level</paragraph>
</columnText>
 </testParagraph>

where the attribute 'listType' value is whether <UL>(wdListBullet) or
<OL>(outlineNumbered) and
attribute 'listLevelNumber' tells about how deep your UL or OL is and
attribute 'listString' can be ignored for <UL>'s but for <OL> it could be 1.
or a. etc.

I was trying to solve looking at following::siblings and preceding::siblings
listValues,listStrings and listLevelNumbers, but failing to recursively
traverse the entire columnText and if try to solve the recursive traverse
the UL's and OL's are messing up.

any ideas??????????????

Ravi





----- Original Message -----
From: mohamed <mohamed@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Wednesday, February 02, 2000 3:41 PM
Subject: Re: Fw:


> Thanks Steve, I like your solution a lot but for some reason it's giving
me
> a
> java.net.MalformedURLException: :
java.lang.StringIndexOutOfBoundsException:
> String index out of range: 0
>
> at this line
> >       <xsl:element name="{document('')/*/xsl:template[@name='attr-map']
> >                           /map[@attr=name($attr-set[1])]/@elem}">
>
> any ideas?
>
> ----- Original Message -----
> From: Steve Tinney <stinney@xxxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxx>
> Sent: Tuesday, February 01, 2000 9:31 PM
> Subject: Re: Fw:
>
>
> > > mohamed wrote:
> > >
> > > I'm trying to call templates based on attribute names:
> > >
> > > <?xml version="1.0"?>
> > >  <testText >
> > >      <text bold="yes">WITH BOLD</text>
> > >      <text bold="yes" italic="yes"> WITH BOLD AND ITALIC</text>
> > >  </testText>
> > > so I declared templates that are called and match bold and italics,
> > >
> > >  <xsl:template match="bold" name="bold">
> > >   <b>
> > >     <xsl:apply-templates/>
> > > </b>
> > > </xsl:template>
> > >
> > > <xsl:template match="italics" name="italics">
> > >   <i>
> > >     <xsl:apply-templates/>
> > > </i>
> > > </xsl:template>
> > >
> > > and I want to get an output as follows:
> > > <b>WITH BOLD</b>
> > > <b><i>WITH BOLD AND ITALIC</i></b>
> >
> > Here is a version which marries recursion and an in-sheet map of
> > attribute names to element names to produce something which is a bit
> > funky to read, but very easy to maintain if you have a 1:1 correlation
> > of attribute names to elements---you just add entries to the map.
> >
> >  Steve
> >
> > <xsl:stylesheet version="1.0"
> >   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >
> > <xsl:output method="html" indent="yes"/>
> >
> > <xsl:template name="attr-map">
> >   <map attr="bold"   elem="b"/>
> >   <map attr="italic" elem="i"/>
> > </xsl:template>
> >
> > <xsl:template match="/">
> >   <xsl:apply-templates/>
> > </xsl:template>
> >
> > <xsl:template match="testText/text">
> >   <xsl:call-template name="format-by-attribute"/>
> > </xsl:template>
> >
> > <xsl:template name="format-by-attribute">
> >   <xsl:param name="attr-set" select="@*[.='yes']"/>
> >   <xsl:variable name="nattr" select="count($attr-set)"/>
> >   <xsl:choose>
> >     <xsl:when test="$nattr = 0">
> >       <xsl:apply-templates/>
> >     </xsl:when>
> >     <xsl:otherwise>
> >       <xsl:element name="{document('')/*/xsl:template[@name='attr-map']
> >                           /map[@attr=name($attr-set[1])]/@elem}">
> >         <xsl:choose>
> >           <xsl:when test="$nattr = 1">
> >             <xsl:apply-templates/>
> >           </xsl:when>
> >           <xsl:otherwise>
> >             <xsl:call-template name="format-by-attribute">
> >               <xsl:with-param name="attr-set"
> >                select="$attr-set[position()>1]"/>
> >             </xsl:call-template>
> >           </xsl:otherwise>
> >         </xsl:choose>
> >       </xsl:element>
> >     </xsl:otherwise>
> >   </xsl:choose>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  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
  • Fw:
    • mohamed - Tue, 1 Feb 2000 15:35:31 -0500
      • Carl Soane - Tue, 1 Feb 2000 18:09:01 -0800
      • Steve Tinney - Tue, 01 Feb 2000 21:31:51 -0500
        • mohamed - Wed, 2 Feb 2000 15:41:33 -0500
          • ravi akireddy - Wed, 2 Feb 2000 17:35:29 -0500 <=
          • Steve Tinney - Wed, 02 Feb 2000 17:56:10 -0500