Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

XSLT: Substring filename

Posted on 2006-06-12
1
Medium Priority
?
549 Views
Last Modified: 2008-03-17
We've a complete filepath:

file://filer12/group/IT/MCU/css/initialize_ns4.css

We need to get ONLY the filename by means of XSL (initialize_ns4.css). How to?
0
Comment
Question by:go4java
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 16887093
Hi go4java,

you need to solve that recursively.
you can use this template "stripPath"
(I put it in a test XSL)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <xsl:call-template name="stripPath">
            <xsl:with-param name="path">c/blabla/blabla/test.xml</xsl:with-param>
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="stripPath">
        <xsl:param name="path"/>
        <xsl:choose>
            <xsl:when test="not(contains($path, '/'))"><xsl:value-of select="$path"/></xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="stripPath">
                    <xsl:with-param name="path" select="substring-after($path, '/')"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
   
</xsl:stylesheet>

Cheers!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question