Barun
Barun

Reputation: 1

xsl to list files in a directory that starts with MyFile

I have a requirement to process all xml files in a directory that starts with MyFile. I am using the below xsl:

<xsl:for-each select="collection('../output/${devid}/?select=MyFile*')">

This is failing with invalid relative uri error. Any suggestions on this?

Upvotes: 0

Views: 181

Answers (1)

Michael Kay
Michael Kay

Reputation: 163488

If devid is the name of a stylesheet parameter, then the way you would substitute this into a collection URI is

<xsl:for-each select="collection('../output/' || $devid || '/?select=MyFile*')">

Alternatively you could do

<xsl:variable name="uri">../output/{$devid}/?select=MyFile*</xsl:variable>
<xsl:for-each select="collection($uri)">

provided that expand-text is set to "true".

Upvotes: 1

Related Questions