I would like to access specific nodes of my ALTO XML files, for that I test collection() Xpath function.
First I have my catalog_alto.xml file :
<?xml version="1.0" encoding="utf-8"?>
<collection>
<doc href="./FRAN_0025_0043_L-0.xml"/>
<doc href="./FRAN_0025_0043_L-1.xml"/>
<doc href="./FRAN_0025_0038_L-0.xml"/>
<doc href="./FRAN_0025_0038_L-1.xml"/>
<doc href="./FRAN_0025_0039_L-0.xml"/>
<doc href="./FRAN_0025_0039_L-1.xml"/>
<doc href="./FRAN_0025_0042_L-0.xml"/>
<doc href="./FRAN_0025_0042_L-1.xml"/>
<doc href="./FRAN_0025_0040_L-0.xml"/>
<doc href="./FRAN_0025_0040_L-1.xml"/>
<doc href="./FRAN_0025_0041_L-0.xml"/>
<doc href="./FRAN_0025_0041_L-1.xml"/>
<doc href="./FRAN_0025_0044_L-1.xml"/>
<doc href="./FRAN_0025_0044_L-0.xml"/>
<doc href="./FRAN_0025_0045_L-1.xml"/>
<doc href="./FRAN_0025_0037_L-1.xml"/>
<doc href="./FRAN_0025_0037_L-0.xml"/>
<doc href="./FRAN_0025_0045_L-0.xml"/>
<doc href="./FRAN_0025_0047_L-0.xml"/>
<doc href="./FRAN_0025_0046_L-1.xml"/>
<doc href="./FRAN_0025_0046_L-0.xml"/>
</collection>
Then I test a first simple XSLT :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://www.namescape.nl/"
xmlns:alto="http://schema.ccs-gmbh.com/ALTO"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="tei"
xpath-default-namespace="http://www.tei-c.org/ns/1.0"
xmlns="http://www.tei-c.org/ns/1.0"
version="2.0">
<xsl:output indent="yes"/>
<xsl:variable name="DOCUMENT" select="collection('catalog_alto.xml')"/>
<xsl:template match="/">
<xsl:for-each select="$DOCUMENT">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
which returns all of my alto xml files to me as follows, so far all is well :
<?xml version="1.0" encoding="UTF-8"?>
<alto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.loc.gov/standards/alto/ns-v4#"
xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v4# http://www.loc.gov/standards/alto/v4/alto-4-0.xsd">
<Description>
<MeasurementUnit>pixel</MeasurementUnit>
<sourceImageInformation>
<fileName>FRAN_0025_0043_L-0.jpg</fileName>
</sourceImageInformation>
</Description>
<Layout>
<Page WIDTH="3006"
HEIGHT="4356"
PHYSICAL_IMG_NR="12"
ID="eSc_dummypage_">
<PrintSpace HPOS="0" VPOS="0" WIDTH="3006" HEIGHT="4356">
<TextBlock ID="eSc_dummyblock_">
<TextLine ID="eSc_line_71454"
BASELINE="2621 315 2889 323"
HPOS="2621"
VPOS="275"
WIDTH="267"
HEIGHT="67">
<Shape>
<Polygon POINTS="2621 315 2623 292 2651 275 2669 285 2680 282 2688 287 2707 282 2726 300 2743 283 2760 288 2777 276 2802 286 2820 283 2841 288 2851 283 2864 287 2870 283 2878 291 2888 289 2886 333 2827 333 2819 340 2809 331 2803 337 2789 337 2782 330 2766 341 2752 331 2730 342 2721 338 2713 341 2705 333 2690 340 2682 331 2671 331 2665 337 2656 332 2651 336 2636 332 2622 318"/>
</Shape>
<String CONTENT="" HPOS="2621" VPOS="275" WIDTH="267" HEIGHT="67"/>
</TextLine>
<TextLine ID="eSc_line_71456"
BASELINE="544 341 697 341"
HPOS="544"
VPOS="288"
WIDTH="151"
HEIGHT="67">
<Shape>
<Polygon POINTS="544 341 546 296 550 292 574 307 591 296 602 298 607 293 619 301 634 288 655 293 664 302 695 301 695 348 687 347 679 355 669 347 646 348 639 353 633 348 546 348"/>
</Shape>
<String CONTENT="" HPOS="544" VPOS="288" WIDTH="151" HEIGHT="67"/>
</TextLine>
<!-- ... continues with all the ALTO files one behind the other. ... -->
However, as soon as I try to access a specific node of the Alto files for example <Layout>
or even <TextBlock>
like for example :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://www.namescape.nl/"
xmlns:alto="http://schema.ccs-gmbh.com/ALTO"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="tei"
xpath-default-namespace="http://www.tei-c.org/ns/1.0"
xmlns="http://www.tei-c.org/ns/1.0"
version="2.0">
<xsl:output indent="yes"/>
<xsl:variable name="DOCUMENT" select="collection('catalog_alto.xml')"/>
<xsl:template match="/">
<xsl:for-each select="$DOCUMENT/descendant::Layout">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I have no more feedback.
I can't understand why the XSL can access the contents of my XML files in the first case and not in the second.
Is my Xpath or my XSL bad?
Do you have any leads? good to you all.