Joe Kesselman wrote:
Quote:
Start by trying a simpler test, in isolation:
>
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="path"
select="'./User_Guide_XML/Applicability_Menu/Insert_Applicability.xml'"/>
<xsl:variable name="xml-name" select="'Insert_Applicability.xml'"/>
<xsl:variable name="image-path-name"
select="'Insert_Applicability_Images/Fig-3.jpg'"/>
<xsl:variable name="graphic-path">
<xsl:value-of select="substring-before($path, $xml-name)"
/><xsl:value-of select="$image-path-name" />
</xsl:variable>
path: <xsl:value-of select="$path" />
xml-name: <xsl:value-of select="$xml-name" />
image-path-name: <xsl:value-of select="$image-path-name" />
s-b(): <xsl:value-of select="substring-before($path,$xml-name)" />
graphic-path: <xsl:value-of select="$graphic-path" />
</xsl:template>
</xsl:stylesheet>
>
Note that this is completely independent of your input document, so it
will check the substring-before logic.
>
Output from Xalan:
>
<?xml version="1.0" encoding="UTF-8"?>
path: ./User_Guide_XML/Applicability_Menu/Insert_Applicability.xml
xml-name: Insert_Applicability.xml
image-path-name: Insert_Applicability_Images/Fig-3.jpg
s-b(): ./User_Guide_XML/Applicability_Menu/
graphic-path:
./User_Guide_XML/Applicability_Menu/Insert_Applicability_Images/Fig-3.jpg
>
... which seems to be what you expected.
Arumph!!! I knew I wasn't crazy hehehe. I don't know what the problem
lies then. I'll have to keep looking. Thanks for looking into it ;-).
I'm thinking maybe a run-time problem? Maybe the string doesn't exist
in the form I want until after everything has been processed which
would result in the string not outputting like I want?
In my example, xml-name is a constructed string. Path is a real string
and so is @source.
As a result for "substring-before($path,$xml-name)", I get an empty
string in my bit of code!!!
If I replace $xml-name with an actual string, It works. But then again,
I was using this construct before using lesser logic and it was
working. The final string wouldn't come empty which tend to mean that
it's NOT a run-time string problem. Hmmm.
Regards
Jean-Francois Michaud