<?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"
    xmlns:tei="http://www.tei-c.org/ns/1.0" 
    exclude-result-prefixes="xs"
    version="2.0">
    <!--I added the xmlns:tei declaration to get the tei namespace, and it works now that I've added tei: prefix below -->
    <!--
    <xsl:output method="xml" indent="yes"/>
    -->
    
    <!-- this is working properly -->
    
    
    <xsl:template match="/">
        <html>
            
            <head>
                <link rel="stylesheet" href="../css/place-list.css"/>
            </head>
            <body>
                <h2>Place Instance Table</h2>
                <table xml:id="place-instance-table" border="1">
                    <tr>
                        <td><h3>xml:id of place</h3></td>
                        <td>Text tagged</td>
                        <td><h3>Filename</h3></td>
                        <td><h3>Document title</h3></td>
                        <td><h3>Omeka URL</h3></td>
                    </tr>
                    
                    <xsl:for-each select="list/entry">
                        
                    
     
                        <xsl:variable name="filename" select="@name"/>
                        <xsl:variable name="omekaURL" select="document(string($filename))//tei:ab"/>
                        <xsl:variable name="docTitle" select="document(string($filename))//tei:titleStmt/tei:title"/>

                        
                        <xsl:for-each select="document(string($filename))//tei:name[@type='place']"> 

                            <tr>
                                <td>               
                                    <placeID><xsl:value-of select="//tei:ptr/@target"/></placeID> 
                                </td>
                                <td>
                                    <textTagged><xsl:copy-of select="."/></textTagged>
                                </td>
                                <td>
                                    <filename><xsl:value-of select="$filename"/></filename>
                                </td>
                                <td>
                                    <docTitle><xsl:value-of select="$docTitle"/></docTitle>
                                </td>
                                <td>
                                    <omekaURL><xsl:value-of select="$omekaURL"/></omekaURL>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </xsl:for-each>
                
                    
                
                        
                     
                </table>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

 