IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

xpath for collection(), bridging folder gap? Options · View
JeffO99
Posted: Tuesday, November 28, 2017 6:05:29 PM
Rank: Newbie

Joined: 11/27/2016
Posts: 3
I'm using XMLSpy 2016 to generate a collection.xml file where the source files (WCAG2 xml) are in subdirectories.

Can't get the two xpath expressions right.

Here's the structure ...

Code:
techniques
    aria.xml
    css.xml

    aria
        ARIA1.xml
            fyi: <technique id="ARIA1">..</technique>
        ARIA2.xml   
    css
        CSS1.xml
        CSS2.xml

In case it helps ...

the main directory contains files named after the subdirectories and each file's root element contains the file name as its @id.

Desired output:

Code:
<collection>
    <doc href="aria/ARIA1.xml"/>
    <doc href="aria/ARIA2.xml"/>
    <doc href="css/CSS1.xml"/>
    <doc href="css/CSS2.xml"/>
</collection>


My busted XSLT uses //*.xml in the collection expression, which is a guess, and my doc expression only works for these files when they're in the same directory, not spread across a dozen.

Code:
<xsl:variable name="files" select="collection('D:/data/main//*.xml')"/>

<collection>
    <xsl:for-each select="$files">
        <doc href="{concat('main/',./element()[1]/@id,'.xml')}"/>
    </xsl:for-each>
</collection>


Thanks!
JeffO99
Posted: Tuesday, January 16, 2018 12:09:09 AM
Rank: Newbie

Joined: 11/27/2016
Posts: 3
The solution had been on xmlplease.com, but it's still available on the web archive:

http://web.archive.org/web/20170424174247/http://www.xmlplease.com:80/collection
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.