<?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"/>
    -->
    
    
    
    <xsl:template match="/">
        <html>
            
            <head>
                <link rel="stylesheet" href="../css/place-list.css"/>
            </head>
            <body>
                <h2>Viola Muse Digital Edition Place Index</h2>
             <!--   <table xml:id="place-list" border="1"> -->
               <!--     <tr>
                        <td><h3>Name</h3></td>
                        <td><h3>Lat., Long.</h3></td>
                        <td><h3>Address</h3></td>
                        <td><h3>Description</h3></td>
                        <td><h3>Occurances</h3></td>
                    </tr>
                    -->
                    
                    <!--
                    <xsl:for-each select="//tei:place">
                        
                        <xsl:sort select="tei:placeName"/>
                        
                        <tr>
                            <td>
                                <xsl:value-of select="tei:placeName"/>
                            </td>
                   
                            <td>
                                <xsl:value-of select="tei:location/tei:geo"/>
                            </td>
                            <td>
                                <xsl:value-of select="tei:location/tei:address"/>
                            </td>

                            <td>
                                <xsl:value-of select="tei:desc"/>
                            </td>
                            <td>Mentioned in...</td>
                            
                        </tr>
                    -->
                        
                        <!-- redo this in paragraph format, and put place ID on paragraph so I can link to them 
                            
                            Name:
                            Coordinates: (can I use this to link to map?)
                            Address:
                            Description: 
                            
                            Occurances: 
                            
                            -->
                        
                        
                        <xsl:for-each select="//tei:place">
                            
                            
                            
                            <xsl:sort select="tei:placeName"/>
                            
                            <xsl:variable name="placeID" select="@xml:id"/>
                            
                            <div id="$placeID"><!-- need to put xml;id of place as id of tr here -->
                                <h2>
                                    <xsl:value-of select="tei:placeName"/>
                                </h2>
                                <p>
                                    <!--ID:--> <xsl:value-of select="$placeID"/>
                                </p>
                             <p>
                                    <!--Coordinates:--> <xsl:value-of select="tei:location/tei:geo"/>
                             </p>
                                <p>
                                    <!--Address:--> <xsl:value-of select="tei:location/tei:address"/>
                                </p>
                                
                                <p>
                                    <!--Description:--> <xsl:value-of select="tei:desc"/>
                                </p>
                                <p>
                                Mentioned in...
                                <ul>
                                    <li>Name of item as link to Omeka</li>
                                    <li>Name of item as link to Omeka</li>
                                    <li>Name of item as link to Omeka</li>
                                </ul>
                                </p>
                                
                            </div>
                        
                    </xsl:for-each>
                    
                    
                    
                    
                    
                    
           <!--     </table> -->
            </body>
        </html>
    </xsl:template>
    
    <!-- from https://blog.ninethsense.com/technology/join-two-xml-files-using-xsl-transformation/ -->
    
        <!--
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
        
        <xsl:param name="fileName" select="'place-instance-table.xml'" />
        
        
        <xsl:variable name="updateItems" select="document($fileName)/shop/product" />
        -->
        
        <!--
        <xsl:template match="@*|node()">
            
            <xsl:copy>
                
                <xsl:apply-templates select="@*|node()" />
                
                <xsl:copy-of select="$updateItems[id=current()/id]/price" />
                
            </xsl:copy>
            
        </xsl:template>
        
    -->
    
    <!--
    <xsl:template match="/">
        <html>
            
            <head>
                <link rel="stylesheet" href="../css/place-list.css"/>
            </head>
            <body>
                <h2>Items marked as &lt;name&gt; with subtype "place" for map upload</h2>
                <table xml:id="place-list" border="1">
                    <tr>
                        <td><h3>Type</h3></td>
                        <td><h3>Lat., Long.</h3></td>
                        <td><h3>Address</h3></td>
                        <td><h3>Name</h3></td>
                        <td><h3>Desc.</h3></td>
                    </tr>
       
                       
                    
                    <xsl:for-each select="//tei:place">
                        
                        
                        
                            <tr>
                           
                                <td>
                                    <xsl:value-of select="@type"/>
                                </td>
                                <td>
                                    <xsl:value-of select="tei:location/tei:geo"/>
                                </td>
                                <td>
                                    <xsl:value-of select="tei:location/tei:address"/>
                                </td>
                                <td>
                                    <xsl:value-of select="tei:placeName"/>
                                </td>
                                <td>
                                    <xsl:value-of select="tei:desc"/>
                                </td>
                        
                            </tr>
                        </xsl:for-each>
                   
                
                    
                
                        
                     
               </table> 
            </body>
        </html>
    </xsl:template> -->
    
</xsl:stylesheet>

 