[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: another beginner question - strip directory info f

Subject: Re: another beginner question - strip directory info from variable
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Oct 2018 08:29:43 -0000
Re:  another beginner question - strip directory info f
Am 14.10.2018 um 03:49 schrieb Dave Lang emaildavelang@xxxxxxxxx:
Hi again everyone - back with another beginner question.

I'm working in Oxygen and am using Saxon.

I'm searching through a bunch of xml files in search of jpg names. I'm creating variables as follows:

<xsl:variable name="allxml" select="collection('..//xml/?select=*.xml;recurse=yes')"/>
<xsl:variable name="jpgs" select="$allxml//element/@n"/>


$jpgs looks like:

dir1/jpg001.jpg dir1/jpg002.jpg dir1/jpg003.jpg

etc.

I want to strip away the dir info, but am having a hard time. I've tried using tokenize and substring-after but both return similar errors.

"A sequence of more than one item is not allowed as the first argument of fn:tokenize() ("dir1/jpg001.jpg", "dir1/jpg002.jpg")."

The variable jpgs is a sequence of attribute nodes, if you want to apply a function to each item in the sequence of nodes you can use


B B B $jpgs/tokenize(., '/')[last()]

and get a sequence of strings.

In XSLT 3 with XPath 3 you can also use

B $jpgs!tokenize(., '/')[last()]

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.