title: XSLT - activate xpath function in XSLT
body: <p>i have the following xml, which is the result of runnig xslt:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;toc xmlns:fn="http://www.w3.org/2004/07/xpath-functions" label="Sample Table of Contents"&gt;
      &lt;topic label="Title1" href="Ref1#ref1"&gt;
          &lt;topic label="Title 2" href="Ref2#ref2"&gt;
              &lt;topic label="Title3" href="Ref3#ref3"/&gt;
              &lt;topic label="Title4" href="Ref4#ref4"/&gt;
          &lt;/topic&gt;
          &lt;topic label="Title5" href="Ref5#ref5"/&gt;
      &lt;/topic&gt;
      &lt;topic label="Title6" href="Ref6#ref6"/&gt;
  &lt;/toc&gt;
  </code></pre>
  
  <p>and the following XSLT that produces this xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="D:\Documents and Settings\oshecht\Desktop\XSL\Copy of toc.xml"?&gt;
  &lt;?altova_samplexml D:\Documents and Settings\oshecht\Desktop\XSL\Copy of toc.xml?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2004/07/xpath-functions"&gt;
      &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt;
      &lt;xsl:template match="BODY"&gt;
          &lt;toc label="Sample Table of Contents"&gt;
              &lt;xsl:apply-templates select="UL/LI/OBJECT"/&gt;
          &lt;/toc&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="OBJECT"&gt;
          &lt;topic label="{param[@name='Name']/@value}" href="{param[@name='Local']/@value}"&gt;
              &lt;xsl:apply-templates select="following-sibling::UL/LI/OBJECT"/&gt;
          &lt;/topic&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>i want that in the output xml i will have in :</p>
  
  <p></p>
  
  <p>the follwing:</p>
  
  <p> - the same line but instead of href="Ref1#ref1" to have:</p>
  
  <p>href="Ref1" - eliminate everything after "#"</p>
  
  <p>i know about the function substring-before(Ref1#ref1,'#') but how can i activate it from my XSLT? </p>
  
  <p>can you please advise?</p>