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

RE: how to get total string-length()

Subject: RE: how to get total string-length()
From: "Matthew L. Avizinis" <mla@xxxxxxxxx>
Date: Fri, 2 Aug 2002 10:01:21 -0400
string length xsl

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of J.Pietschmann
> Sent: Thursday, August 01, 2002 3:46 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  how to get total string-length()
> 
> 
> Matthew L. Avizinis wrote:
> > Hello all,
> > If I have the following snippet:
> > 
> > <fo:block margin-right="{concat(NNN*1.5),'mm')}">
> > --------------------------------^^^
> >    <xsl:call-template name="process-nodes"/>
> >    <xsl:if test="not(@no-pg-num)">
> >        <fo:leader leader-pattern="dots" leader-pattern-width="2.0mm"
> > leader-alignment="reference-area"/>
> >    </xsl:if>
> >    <xsl:for-each
> > select="document(concat($libname,'/index.xml'))//index/index-term[@id =
> > $primary]">
> >       <xsl:value-of select="."/><xsl:if test="position() !=
> > last()">,&nbsp;</xsl:if>
> >    </xsl:for-each>
> > </fo:block>
> > 
> > In the for-each line I grab each index-term that has an id that 
> matches the
> > value in $primary.  Thus I could have a line like
> >    the index entry..........123, 234, 345
> > 
> > What I want to be able to do is, using the example in the line above,
> > calculate the number of characters in "123, 234, 345" and be 
> able to insert
> > it in the NNN location in the block margin-right location.  
> Obviously I need
> > to figure this out outside/before the block, but howto, that's 
> the question.
> 
> This appears to be really easy: put it into a variable
> and use string-length:
> 
> <xsl:variable name="page-list">
>     <xsl:for-each
>      select="document(concat($libname,
>        '/index.xml'))//index/index-term[@id = $primary]">
>        <xsl:value-of select="."/><xsl:if test="position() !=
>       last()">,&nbsp;</xsl:if>
>     </xsl:for-each>
> </xsl:variable>
> 
> 
> <fo:block margin-right="{concat(string-length($page-list)*1.5),'mm')}">
>     <xsl:call-template name="process-nodes"/>
>     <xsl:if test="not(@no-pg-num)">
>         <fo:leader leader-pattern="dots" leader-pattern-width="2.0mm"
>          leader-alignment="reference-area"/>
>     </xsl:if>
>     <xsl:value-of select="$page-list"/>
> </fo:block>
> 
> If you have any markup in the page number list, like fo:basic-links,
> use xsl:copy-of instead of xsl:value-of.
> 
> J.Pietschmann
> 
> 
>  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.