Hi,

Is it possible to use the tokenize function in an XSL transformed by cocoon? I've had a little play with something like the following transform:

<xsl:stylesheet version="2.0"
      xmlns:fn="http://www.w3.org/2004/10/xpath-functions";
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:cinclude="http://apache.org/cocoon/include/1.0";>

   <xsl:param name="url"/>

   <xsl:variable name="urlTokens" select="fn:tokenize($url, '/')"/>
   <!-- the following line is fine -->
   <xsl:variable name="urlToken1" select="fn:item-at($urlTokens, 1)"/>

   <!-- Something like this line fails with "Unknown error in XPath" -->
   <xsl:value-of select="$urlToken1" />

   <!-- Something like this line fails with an NPE -->
   xsl:value-of select="fn:item-at($urlTokens, 0)" />


Would Saxon work here?

Would JX be my friend by allowing me to call a StringTokenizer?

I've not really used the JX stuff, and not sure what it's advantages are over XSL when working directly with an XML backend.

How else do you suggest I do this?

I could pass the parameters is from the sitemap, tokenising there with the matcher, but it would mean creating multiple match sections for each level. I might have to do that if there's nothing "neater".

To take a step back, I'm trying to create a trail (breadcrumbs, etc), I had look previously for examples, as I seem to recall seeing one, but couldn't find anything.

Given a URI like:
http://www.host.com/1/2/3.x
or just
http://www.host.com/1.x

I'd like a trail that looks like:

1 -> 2 -> 3
with links to 1.x, 2.x, 3.x
or
1
with a link to 1.x

Well, I can sort out all the rendering, I just don't know how to tokenize the URI I'm passing in. Or am I approaching it wrong?

Thanks for your time,
Ben Pope.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to