xsl-list
[Top] [All Lists]

Re: [xsl] Accessing the XML file name from an XSL Transform

2010-11-15 12:51:25

Ok. I'm missing a little bit more, I'm afraid. I think this is to do with 
variable scope, but I'm stood ready to be corrected.

Spot on.
I''ve got this:-

8<----------------
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="yes" name="TextFormat" 
omit-xml-declaration="yes"/>
<xsl:param name="OutputPath" />
<xsl:variable name="FileFullPathName" select="document-uri(/)"/>
<xsl:variable name="FileName" />

<xsl:template match="/hello-world">
<xsl:analyze-string select="$FileFullPathName"
regex="[^/]+$">
<xsl:matching-substring>
<xsl:variable name="FileName" select="." />
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>


You want something like:

<xsl:variable name="FileName">
<xsl:analyze-string ....
</xsl:analyze-string>
</xsl:variable>

Or more simply, perhaps the logic is the same as

<xsl:variable name="FileName" select="tokenize($FileFullPathName), '/')[last()]"/>

Michael Kay
Saxonica


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--