xsl-list
[Top] [All Lists]

Re: [xsl] Re: Anyone have XSLT that generates XML showing a Windows folder structure?

2020-05-13 11:23:59
Am 13.05.2020 um 17:37 schrieb Costello, Roger L. costello(_at_)mitre(_dot_)org:

I decided to go the route that John suggested, and use the EXPath File module. 
John was right, it was fairly easy to implement the desired functionality using 
the EXPath File module. Below is what I created. It seems to work fine. If you 
see any potential problems in it, or ways to improve it, please let me know.  
/Roger


     <xsl:function name="f:remove-last-slash-filename-from-URI" as="xs:string">
         <xsl:param name="uri" as="xs:string"/>

         <xsl:value-of select="f:reverse-string(substring-after(f:reverse-string($uri), 
'/'))"/>

     </xsl:function>

I think with pure XPath I tend to use
  tokenize($uri, '/')[last()]
here to select the file name.

Not sure if the EXPath module also has some helper for that.

But the reverse-string(substring-after looks a bit too complicated to me
with access to the tokenize function.


--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>