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

Creating List with xsl:function

Subject: Creating List with xsl:function
From: "Philip Vallone" <philip.vallone@xxxxxxxxxxx>
Date: Fri, 17 Nov 2006 18:05:35 -0500
list in xsl
Hi All,

I am having trouble creating list in XSLT 2.0. I am trying an example from
XSLT 2.0 3rd edition (chapter 10) (Wrox), but having trouble getting it to
work in my stylesheet.

The example to the book shows:

	<xsl:function name="f:olist-format" as="xs:string">
		<xsl:param name="node" as="node()"/>
		<xsl:sequence select="('1', 'a', 'i', 'A', 'I')
[count($node/ansestor::olist) mod 5 + 1] "/>
	</xsl:function>


<xsl:template match="olist">		
			<ol class="enum{$f:list-format(.)}"> 
				<xsl:apply-templates/> 
			</ol>
</xsl:template>

Mine looks like this:

Namespace in SCHEMA is "ACM".
	
<xsl:function name="ACM:list-format" as="xs:string">
	<xsl:param name="node" as="node()"/>
	<xsl:sequence select="('1', 'a', 'i', 'A', 'I')
[count($node/ansestor::list) mod 5 + 1] "/>
</xsl:function>

<xsl:template match="ACM:list">
	<xsl:for-each select="ACM:Para">
			<ol class="enum{ACM:list-format(.)}">
				<xsl:apply-templates/>
			</ol>
	</xsl:for-each>
</xsl:template>

I receive this error:

"Invalid XPath 2.0 expression Unexpected token. Probably missing valid axis
name before '::'  - "::ACM:list) mod 5 + 1] ""

I assume I am not declaring the Function properly. Can the XSL:Function be
placed anywhere in the stylesheet as long as it is a child of
</xsl:stylesheet>? Do I need to declare a namespace for a function?  And if
so how? I am a little lost.

Thanks,

Phil

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.