XSL模板选择

时间:2016-10-21 13:09:02

标签: json xslt select display

我有一些连接到Exchange-Server的不同分辨率的无线显示器,以显示一些日历信息。对于此任务,使用3个文件:config.json,exchange_display_updater.py和overlay.xsl。该配置适用于最大的显示,因为overlay.xsl包含该分辨率的渲染信息。问题是如何为其他显示器(尚不存在)选择渲染信息。 .xsl看起来像这样:

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

    <xsl:template match="Record">
        <!-- Render for 7.4 inch labels -->
        <image height="480" width="800" rotation="90" font-family="Verdana">
            <!-- Room -->
            <field height="140" width="580" x="0" y="0" background-color="black">
                <text align="center" padding-top="10" font-size="40" font-weight="bold"
                    color="white">
                    <utils method="toUpperCase">
                        <xsl:value-of select="room/@roomName"/>
                    </utils>
                </text>
                <!-- Date -->
                <text align="center" font-size="35" font-weight="bold" padding-top="10"
                    color="white">
                    <xsl:value-of select="room/field[@key = 'date']/@value"/>
                </text>
            </field>
            <!-- Image -->
            <field align="right" height="140" width="220" x="580" y="0" background-color="black">
                <img src="../images/Moelln_Logo.png" invert="True"/>
            </field>
            <line thickness="2" x-from="0" x-to="800" y-from="130" y-to="130"/>
            <!-- Time1 -->
            <field height="50" width="780" x="20" y="150">
                <text align="left" font-weight="bold" font-size="40">
                    <xsl:value-of select="room/field[@key = 'time1']/@value"/>
                </text>
            </field>
            <!-- Purpose1 -->
            <field height="50" width="780" x="20" y="200">
                <text align="left" font-size="40" condense="1, 0.8, 0.6, 0.5">
                    <xsl:value-of select="room/field[@key = 'purpose1']/@value"/>
                </text>
            </field>
            <!-- Chair1 -->
            <field height="40" width="770" x="20" y="250">
                <text align="left" font-weight="bold" font-size="30">
                    <xsl:value-of select="room/field[@key = 'chair1']/@value"/>
                </text>
            </field>
            <!-- Time2 -->
            <field height="35" width="780" x="20" y="320">
                <text align="left" font-size="28">
                    <xsl:value-of select="room/field[@key = 'time2']/@value"/>
                </text>
            </field>
            <!-- Purpose2 -->
            <field height="35" width="780" x="20" y="355">
                <text align="left" font-size="28" condense="1, 0.8, 0.6, 0.5">
                    <xsl:value-of select="room/field[@key = 'purpose2']/@value"/>
                </text>
            </field>
            <!-- Chair2 -->
            <field height="30" width="770" x="20" y="390">
                <text align="left" font-size="20">
                    <xsl:value-of select="room/field[@key = 'chair2']/@value"/>
                </text>
            </field>
        </image>
    </xsl:template>
</xsl:stylesheet>

每个显示在config.json中都有唯一的ID和名称,但我不知道如何才能使这个工作。 .json看起来像这样:

{
    "wireless_display_server": {
        "address": "ADDRESS",
        "port": 8001
    },
    "exchange_server": {
        "version": "Exchange2013_SP1",
        "default_credentials": false,
        "user": "USERNAME",
        "password": "PASSWORD",
        "domain": "DOMAIN",
        "autodiscover_url_from_email": false,
        "autodiscover_email": "EMAIL@DOMAIN",
        "url": "https://exchange.DOMAIN/EWS/Exchange.asmx"
    },
    "conference_label": {
        "template": "lcsconference_landscape.xsl",
        "no_new_data_message": "Keine Reservierungen"
    },
    "displays": [
        {
            "exchange_room_mailbox": "Room1@domain",
            "display_id": "D1012163",
            "display_name": "Room1"
        },
        {
            "exchange_room_mailbox": "Room2@domain",
            "display_id": "C10208BA",
            "display_name": "Room2"
        }
    ]
}

0 个答案:

没有答案