Re: [xsl] Substring a Value

Subject: Re: [xsl] Substring a Value
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 9 Aug 2004 22:09:22 +0100
Hi Trevor,

> In order to be able to use xslt functionality in the xsl file, can I
> just add an additional schema, and rebuild the link code using a
> reference to the additional schema? (I thought about this after
> surfing your site).

There's no way to use XSLT functionality in the WD-XSL stylesheet. (I
couldn't follow your suggestion; I think you're using the term
'schema' when you mean 'namespace', but I'm not sure.)

If you're doing a batch transformation (or you're doing the
transformation server-side and are happy hacking the script that
controls it, or you're happy doing a one-off change to your XML
documents) I suppose what you could do is take the XML input and put
it through a simple XSLT transformation to change the from attributes.
That would look like:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="@from">
  <xsl:attribute name="from">
    <xsl:value-of
      select="substring-before(substring-after(., 'ID('), ')')" />
  </xsl:attribute>
</xsl:template>
                
<xsl:template match="node()|@*">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
  </xsl:copy>
</xsl:template>
                
</xsl:stylesheet>

Then you could run your existing WD-xsl stylesheet on the result.

Of course it's very possible that WD-xsl has a substring function; I
just don't know it. There must be some documentation for WD-xsl around
somewhere (and I think that there are some Microsoft-hosted mailing
lists), I just don't have a clue where they are.

My best advice is to update your WD-xsl stylesheet to XSLT. In the
long run, it will save you time and energy, not least because then
very many people on this excellent mailing list will be able to help
you with it.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread