[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Finding the path from the filename
You can also use substring-after. I'm pretty sure this is a faq, anyway it's one of those things that I've got the bad habit of writing anew as I need it rather than just going to get it from some place I've got it and copying, so there's always some sort of error likely to crop in without testing, you may have to rearrange some parts after testing on your own. <xsl:param name="filepathANDname"/> <xsl:variable name="filename"> <xsl:call-template name="filenamegetter"><xsl:with-param name="thisPathANDname" select="$filepathANDname"/> </xsl:call-template> </xsl:variable> <xsl:variable name="filepath"><xsl:value-of select="substring-before($filepathANDname,$filename)"/></xsl:variable> <xsl:template name="filenamegetter"> <xsl:param name="thisPathANDname"/> <xsl:variable name="afterthisPathANDname" select="substring-after($thisPathANDname,'\')"/> <xsl:choose><xsl:when test="contains($thisPathANDname,'\')"> <xsl:call-template name="filenamegetter"><xsl:with-param name="thisPathANDname" select="$afterthisPathANDname"/></xsl:call-template> </xsl:when><xsl:otherwise><xsl:value-of select="$thisPathANDname "/></xsl:otherwise></xsl:choose> </xsl:template> note that Cams example with lastCharPosition could be used to make this process much more generic. Note that I would not say this is a 100% secure method but close enough not to be easily discernable from the 100% secure. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|