3

XSLTSL seems to claim that we can use EXSLT without downloading its source:

Import or include either the main stylesheet, or the stylesheet module you wish to use, directly from the library website; http://xsltsl.sourceforge.net/modules/. The modules directory always contains the latest stable release.

I've tried this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="http://xsltsl.sourceforge.net/modules/string.xsl"/>
  <xsl:output method="text" indent="yes"/>

  <xsl:template match="/">
    <xsl:call-template name="str:to-upper">
      <xsl:with-param name="text">hello world</xsl:with-param>
    </xsl:call-template>
  </xsl:template>
</xsl:stylesheet>

But its not working. I don't seem to be able to use EXSLT without downloading its source.

Is there anyway to use EXSLT without downloading its source?

Pacerier
  • 86,231
  • 106
  • 366
  • 634

2 Answers2

2

As is explaind in Using the library, you need to download it and

<xsl:import href="stdlib.xsl"/>

import it into your xslt script.

Btw, as an alternative you can also use the xslt translate function:

translate(value,"abcdefghijklmnopqrstuvwxyz","ABCBCDEFGHIJKLMNOPQRSTUVWXYZ")

It is a bit big to use in multiple places, but as long as you can place this in a template that shouldn't matter much.

rsp
  • 23,135
  • 6
  • 55
  • 69
  • heys i'd still can't get it to work. btw i've edited the question take a look at it – Pacerier Jun 11 '11 at 12:55
  • @Pacerier, looks like you forgot to declare the namespace using `xmlns:str="http://xsltsl.org/string"` in the ` – rsp Jun 11 '11 at 16:58
1

You are not using the library correctly. Take a look at the instructions here.

Once you have downloaded the library, you need to:

1) Add an import to your xsl file:

<xsl:import href="string.xsl"/>

2) Add a namespace:

xmlns:str="http://xsltsl.org/string"

3) Call the template like this:

<xsl:template match="foo">
  <xsl:call-template name="str:to-upper">
    <xsl:with-param name="text">hello world</xsl:with-param>
  </xsl:call-template>
</xsl:template>

This will produce HELLO WORLD.

UPDATE:

No, you do not need to download the library locally. You can simply link to string.xsl using the full URL.

dogbane
  • 266,786
  • 75
  • 396
  • 414