Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 25th, 2014, 10:04 AM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2013
Posts: 31
Thanks: 3
Thanked 0 Times in 0 Posts
Default Count the string length of descendant, ignore children

I've the below XML.

            <star.page>94</star.page> (a)</label>
            <label>(b)</label>  As the
and i was trying to get the maximum string length of label by ignoring child nodes of label, I'm trying to do this using the below.

	<xsl:template name="orderedlist" match="list">
		<xsl:variable name="strl">
				<xsl:when test="descendant::list.item/label/node()[self::star.page]">
					<xsl:value-of select="max(descendant::list.item/label/string-length(node()[not(*)]))"/>
					<xsl:value-of select="max(descendant::list.item/label/string-length(text()))"/>
			<xsl:value-of select="$strl"/>
			<xsl:when test="$strl > '6'">
				<ol class="eng-orderedlist orderedlist1">
				<ol class="eng-orderedlist orderedlist">
	<xsl:template name="orderitem" match="list.item">
		<xsl:apply-templates select="./label/node()[1][self::star.page]" mode="first"/>
		<li class="item">
			<div class="para">
				<xsl:if test="./label">
					<span class="item-num">
						<xsl:value-of select="./label/text()"/>
					<xsl:when test="./text()">
						<xsl:apply-templates select="child::node()[fn:not(self::label)]"/>
						<xsl:text> </xsl:text>

but it is giving the below error.

XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/Proview/Law%20Reports/HK/11NOV/P1/XML/XSLT/Reports(RXXX_sma-DXXXHX).xslt:1421: Wrong occurrence to match required sequence type -   Details: -     XPTY0004: The supplied sequence ('3' item(s)) has the wrong occurrence to match the sequence type xs:string ('zero or one')
please let eme know where am i going wrong.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display the Length of the String kulfi BOOK: Beginning Microsoft Visual Basic 2010 15 December 30th, 2010 04:41 PM
How to fix string length Ivanchan Excel VBA 2 July 26th, 2007 08:55 AM
string-length problem alapati.sasi XSLT 3 July 4th, 2007 10:08 AM
Chap 3, "Length of String" richajos BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 February 25th, 2006 08:38 PM

All times are GMT -4. The time now is 05:04 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.