Re: [xsl] another beginner question - strip directory info from variable

Subject: Re: [xsl] another beginner question - strip directory info from variable
From: "Terry Badger terry_badger@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 Oct 2018 12:41:51 -0000
Hi Dave,B Try this using xsl:value-of to bring the strings together as one and
use them in xsl:analyse-srting to create a group for each item you want.
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema"; exclude-result-prefixes="xs"
version="2.0"> <xsl:param name="string-1"
as="xs:string">dir1/jpg001.jpg</xsl:param> <xsl:param name="string-2"
as="xs:string">dir2/jpg002.jpg</xsl:param> <xsl:param name="string-3"
as="xs:string">dir3/jpg003.jpg</xsl:param> <xsl:variable name="string"
select="$string-1, $string-2, $string-3"/> <xsl:variable name="string-all">
<xsl:value-of select="$string"/> </xsl:variable> <xsl:template name="main">
<main> <xsl:analyze-string select="$string-all"
regex="(([a-z0-9]*)/([a-z0-9\.]*) ?)"> <xsl:matching-substring> <group> <path>
<xsl:value-of select="regex-group(2)"/> </path> <file> <xsl:value-of
select="regex-group(3)"/> </file> </group> </xsl:matching-substring>
</xsl:analyze-string> </main> </xsl:template></xsl:stylesheet>
Terry BadgerXML DeveloperRochester, NY(585)-781-0789





 On Sunday, October 14, 2018, 2:43:17 PM EDT, B Tommie Usdin
btusdin@xxxxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:





Hi Dave b

It looks like the list is being helpful to you. There is something you could
do in the future to be helpful to the list: focus your subject lines on the
topic of the question. In this case, "strip directory info from variable"
would have been a far better subject line than "another beginner question -
strip directory info from variableb. This is because many people refer to
the list archives and third-party list archives by scanning subject lines to
find discussions that may help them. By making the subject line about you and
not about your topic you make reuse of the discussion much more difficult.

It seems to me that many people may have your question and this discussion
would be helpful to them, too.

Thanks for making a moment to think about subject lines before your future
posts to XSL-list.

b Tommie


> On Oct 13, 2018, at 9:49 PM, Dave Lang emaildavelang@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> 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")."
>
> Because I don't know what I'm doing, I don't know what I'm doing wrong. :)
>
> Can anyone help me figure out how to solve this problem?
>
> thanks!
> dave
>

======================================================================
B. Tommie UsdinB  B  B  B  B  B  B  B  B  B  B  B 
mailto:btusdin@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.B  B  B  B  B  B  B  https://www.mulberrytech.com
17 West Jefferson StreetB  B  B  B  B  B  B  B  B  B  B  B  B  Phone:
301/315-9631
Suite 207B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  Direct Line:
301/315-9634
Rockville, MDB  20850B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  Fax:
301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in XML and SGMLB  B  B  B 
B  B  B 

======================================================================

Current Thread