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

Re: Display count function output as letter value inst

Subject: Re: Display count function output as letter value instead of number value
From: Sharon_Harris@xxxxxxxxxxxxxxxxxxxx
Date: Tue, 19 Aug 2008 10:37:58 -0400
Re:  Display count function output as letter value inst
xsl:number does not output the numbering correctly. I have tried various
ways of using xsl:number and though I can get a letter to output instead of
a number, the sequence is wrong. Below are the various ways I have tried
using xsl:number and the output I received. Please excuse me for the length
of this post but I wanted to list all the different methods I had tried.
Also please note that after the 1st listing, I only noted the block that
contained the xls:number function rather than repeating the entire element
definition since nothing else had changed.

      <xsl:template match="//SelfStudy" mode="toc">
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>

      </fo:block>
                  <xsl:apply-templates
      select="SelfStudyContent/SelfStudyOverview/Body
       | SelfStudyReuse/SelfStudyReference |
      SelfStudyReuse/SelfStudyConcept |
      SelfStudyReuse/SelfStudyConcept/CuInline/ContentUnit/CuContent/Concept/ConceptBody/subcontent/subheading
 | SelfStudyReuse/SelfStudyGWT |
      SelfStudyReuse/SelfStudyGWT/CuInline/ContentUnit/CuContent/GuidedWalkThrough/Instructions/ConceptReview/ConceptReviewTitle
 | SelfStudyReuseSelfStudyGWT/CuInline/ContentUnit/CuContent/GuidedWalkThrough/Instructions/SubInstruction/gwtSubHeading"
 mode="toc"/>

            </xsl:template>

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      **********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>



                        <xsl:for-each select="//SelfStudy">
                                    <xsl:number format="A"/></xsl:for-each>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
      ...

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      **********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number count="//SelfStudy"
      format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
      ...

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      **********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number count="//SelfStudy"
      from="//SelfStudy" format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study - Title
      Self Study - Title
      Self Study - Title
      ********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number from="//SelfStudy"
      format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study - Title
      Self Study - Title
      Self Study - Title
      *******************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number count="SelfStudy"
      format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      *********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number value="position()"
      format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study AA - Title
      Self Study AB - Title
      Self Study AC - Title
      ***********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number level="single" format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      **********************

      ...
      <fo:block xsl:use-attribute-sets="TOC1">
                        <xsl:text>Self Study&#160;</xsl:text>




                                    <xsl:number level="multiple"
      format="A"/>
                                    <xsl:text>&#160;-&#160;</xsl:text>
                                    <xsl:value-of
      select="../../CuMetadata/Title"/>

                        <fo:block
      xsl:use-attribute-sets="TOCLeaderSpacing">
                              <fo:leader
      xsl:use-attribute-sets="MediumLeader"/>
                        </fo:block>
                  </fo:block>
      ...

      Output
      ----------
      Self Study A - Title
      Self Study A - Title
      Self Study A - Title
      **********************

Thanks for your help! Sharon
_______________________________
Sharon Goldner Harris
Knowledge Management Evangelist
Ultimate Software Group
704-660-6482

Confidentiality Note: This e-mail message and any attachments to it are
intended only for the named recipients and may contain legally privileged
and/or confidential information. If you are not one of the intended
recipients, do not duplicate or forward this e-mail message.


**************************************************************************************************************************************************************
Re:  Display count function output as letter value instead of number
value
|-----------------------------------------------------------------|
|Subject: Re:  Display count function output as letter value |
|instead of number value                                          |
|From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>                  |
|Date: Mon, 18 Aug 2008 13:58:09 +0100                            |
|-----------------------------------------------------------------|


> I would like to output a letter instead of a number when performing a
count
> for a specific element.

I think it's just format="A" on xsl:number to get "A", "B" etc...

Either way look up xsl:number and go from there.

--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/


*****************************************************************************************************************************************************
 Display count function output as letter value instead of number value
|--------------------------------------------------------------|
|Subject:  Display count function output as letter value  |
|instead of number value                                       |
|From: Sharon_Harris@xxxxxxxxxxxxxxxxxxxx                      |
|Date: Mon, 18 Aug 2008 08:53:22 -0400                         |
|--------------------------------------------------------------|


I would like to output a letter instead of a number when performing a count
for a specific element.

For example, the code snippet:

<xsl:template match="//SelfStudy" mode="toc">
            <fo:block xsl:use-attribute-sets="TOC1">
                  <xsl:text>Self Study&#160;</xsl:text>
                              <xsl:value-of select="
count(preceding::SelfStudy)+1"/>
                              <xsl:text>&#160;-&#160;</xsl:text>
                              <xsl:value-of select="../../CuMetadata/Title
"/>

                  <fo:block xsl:use-attribute-sets="TOCLeaderSpacing">
                        <fo:leader xsl:use-attribute-sets="MediumLeader"/>
                  </fo:block>
            </fo:block>
            <xsl:apply-templates select="
SelfStudyContent/SelfStudyOverview/Body  |
SelfStudyReuse/SelfStudyReference | SelfStudyReuse/SelfStudyConcept |
SelfStudyReuse/SelfStudyConcept/CuInline/ContentUnit/CuContent/Concept/ConceptBody/subcontent/subheading

 | SelfStudyReuse/SelfStudyGWT |
SelfStudyReuse/SelfStudyGWT/CuInline/ContentUnit/CuContent/GuidedWalkThrough/Instructions/ConceptReview/ConceptReviewTitle

 |
SelfStudyReuseSelfStudyGWT/CuInline/ContentUnit/CuContent/GuidedWalkThrough/Instructions/SubInstruction/gwtSubHeading

" mode="toc"/>
</xsl:template>

would produce the following:
   SelfStudy 1 - Title
   SelfStudy 2 - Title
   SelfStudy 3 - Title
   ...

However, I would like it to output as follows:
   SelfStudy A - Title
   SelfStudy B - Title
   SelfStudy C - Title

How do I get the count to output as a letter value instead of a number
value?

Thanks for your help! Sharon
_______________________________
Sharon Goldner Harris
Knowledge Management Evangelist
Ultimate Software Group
704-660-6482

Confidentiality Note: This e-mail message and any attachments to it are
intended only for the named recipients and may contain legally privileged
and/or confidential information. If you are not one of the intended
recipients, do not duplicate or forward this e-mail message.

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.