从特定位置显示对象标签内容

时间:2018-12-18 11:20:40

标签: javascript html html5 object-tag

我有一个显示另一个网站的对象标记,现在我想从滚动的某个位置显示对象的内容,我尝试使用javascript,但没有任何效果。您建议做什么?

即HTML:

<script>
    document.getElementById("bmeteo").scroll(0,150);
</script>

JS:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" version="5.0" />


    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="Tree">
        <table>
            <!-- process the first row -->
            <xsl:call-template name="process_first_group">
                <xsl:with-param name="group" select="*[not(preceding-sibling::RowBreak) 
                    and not(self::RowBreak)]"/>
            </xsl:call-template>
            <xsl:apply-templates select="RowBreak"/>
        </table>
    </xsl:template>

    <!-- succeeding rows that start with RowBreak -->
    <xsl:template match="RowBreak">
        <xsl:variable name="row_ID" select="generate-id()"/>
        <xsl:variable name="prec_Col" select="count(preceding-sibling::ColumnBreak)"/>
        <xsl:call-template name="process_other_group">
            <xsl:with-param name="group" select="following-sibling::*[not(self::RowBreak)]
                [preceding-sibling::RowBreak[1]
                [generate-id()=$row_ID]
                ]"/>
            <xsl:with-param name="row_ID" select="$row_ID"/>
            <xsl:with-param name="prec_Col" select="$prec_Col"/>
        </xsl:call-template>
    </xsl:template>

    <xsl:template name="process_first_group">
        <xsl:param name="group"/>
        <xsl:for-each select="$group[self::Item[not(preceding-sibling::ColumnBreak)]]">
            <xsl:variable name="pos" select="position()"/>
            <tr>
                <td>
                    <xsl:value-of select="."/>
                </td>
                <xsl:for-each select="following-sibling::ColumnBreak">
                    <xsl:variable name="col_ID" select="generate-id()"/>
                    <xsl:apply-templates select="$group[self::Item
                        [preceding-sibling::ColumnBreak[1]
                        [generate-id()=$col_ID]
                        ]
                        [position()=$pos]
                        ]"/>
                </xsl:for-each>
            </tr>
        </xsl:for-each>
    </xsl:template>

    <xsl:template name="process_other_group">
        <xsl:param name="group"/>
        <xsl:param name="row_ID"/>
        <xsl:param name="prec_Col"/>
        <xsl:for-each select="$group[self::Item[count(preceding-sibling::ColumnBreak)=$prec_Col]]">
            <xsl:variable name="pos" select="position()"/>
            <tr>
                <td>
                    <xsl:value-of select="."/>
                </td>
                <xsl:for-each select="$group[self::ColumnBreak[preceding-sibling::RowBreak[generate-id()=$row_ID]]]">
                    <xsl:variable name="col_ID" select="generate-id()"/>
                    <xsl:apply-templates select="following-sibling::Item[preceding-sibling::ColumnBreak[1][generate-id()=$col_ID] and preceding-sibling::RowBreak[1][generate-id()=$row_ID]][position()=$pos]"/>
                </xsl:for-each>
            </tr>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="Item">
        <td><xsl:apply-templates/></td>
    </xsl:template>

    <xsl:template match="Label">
        <xsl:apply-templates/>
    </xsl:template>

</xsl:stylesheet>

0 个答案:

没有答案