<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <!-- set output method="xml|html|text" -->
    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />

    <!-- include templates from other files -->
    <xsl:include href="../wp-content/plugins/tenandtwo-xslt-processor/xsl/date.xsl" />
    <xsl:include href="../wp-content/plugins/tenandtwo-xslt-processor/xsl/string.xsl" />

    <!-- main -->
    <xsl:template match="/">
        <table class="ecole-jci-table" style="border: none;"><tbody>
            <xsl:for-each select="//Job">
                <tr>
                    <td style="vertical-align: middle; white-space: nowrap; border: none; box-shadow: none; border-top: 1px solid #C1BDB9; border-bottom: 1px solid #C1BDB9;background-color: transparent; color: #000;font-size: 12px;">
                        <xsl:apply-templates select="./Posting" />                 
                    </td>
                    <td style="vertical-align: middle; white-space: nowrap;border: none; box-shadow: none; border-top: 1px solid #C1BDB9; border-bottom: 1px solid #C1BDB9; font-weight: 900; font-size: 14px;background-color: transparent;">
                        <xsl:call-template name="string-upper">
                            <xsl:with-param name="value" select="./Position/Title" />
                        </xsl:call-template>
                    </td>
                    <td style="vertical-align: middle; border: none; border-top: 1px solid #C1BDB9; border-bottom: 1px solid #C1BDB9; padding-right: 0;background-color: transparent;">
                        <img decoding="async" src="https://ecole.hermes.com/wp-content/uploads/2022/06/pin.svg" style="width: 12px;max-width: none;margin-top: 4px" width="12px" />
                    </td>
                    <td style="vertical-align: middle; border: none; box-shadow: none; border-top: 1px solid #C1BDB9; border-bottom: 1px solid #C1BDB9; white-space: nowrap;background-color: transparent;padding-left: 8px;max-width: calc(100% - 37px);">
                        <a target="_blank" rel="nofollow noopener" style="text-decoration: underline; line-height: 20px; display: inline-block; white-space: normal;">
                            <xsl:attribute name="href"><xsl:value-of select="concat('https://www.google.com/maps/search/?api=1&query=', ./Location/City, ', ', ./Location/Country/@Code )"/></xsl:attribute>
                            <xsl:call-template name="string-upper">
                                <xsl:with-param name="value" select="./Location/City" />
                            </xsl:call-template>
                            <xsl:value-of disable-output-escaping="yes" select="concat( ', ', ./Location/Country/@Code )"/>
                        </a>
                    </td>
                    <td style="vertical-align: middle; border: none; box-shadow: none; border-top: 1px solid #C1BDB9; border-bottom: 1px solid #C1BDB9;background-color: transparent;">
                        <a target="_blank" style="color:#444; text-decoration:none; font-style: normal; font-weight: normal; font-size: 12px; text-transform: uppercase;background-color: #FFEE02;border-radius: 3px;border: 0;padding: 0 16px; white-space: nowrap;height: 40px;display: block;text-align: center;vertical-align: middle;line-height: 40px;" rel="noopener">
                            <xsl:attribute name="href"><xsl:value-of select="./Posting/CandidateResponses/URL"/></xsl:attribute>
                            détail de l’offre
                        </a>
                    </td>
                </tr>
            </xsl:for-each>
        </tbody></table>
    </xsl:template>

    <!-- date nodes : use template from date.xsl to format (and shift) the value -->
    <xsl:template match="Posting">
        <xsl:call-template name="date-format">
            <xsl:with-param name="value"><xsl:value-of select="./@DateCreated" /></xsl:with-param>
            <xsl:with-param name="format">d.m.Y</xsl:with-param>
        </xsl:call-template>
    </xsl:template>

</xsl:stylesheet>
<!-- end sample.xsl -->