zoukankan      html  css  js  c++  java
  • xsl:for-each中引用循环外全局变量

    //全局变量

    <xsl:variable name="temp_driving_type" select="WebPage/Data/OptReturnData[@OptRetName='GetEmpCarById']/OptRetData/NewDataSet/Table/driving_type"/>
    <select class="Input" name="driving_type" id="driving_type">
    <xsl:for-each select="WebPage/Data/OptReturnData[@OptRetName='GetEmpCarTypeNames']/OptRetData/NewDataSet/Table">
    <xsl:choose>
    <xsl:when test="contains($temp_driving_type,id)">
    <option value="{id}" selected ="selected">
    <xsl:value-of select="name"/>
    </option>
    </xsl:when>
    <xsl:otherwise>
    <option value="{id}">
    <xsl:value-of select="name"/>
    </option>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:for-each>
    </select>

    //全局参数

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">

    <xsl:template match="/">
    <xsl:param name="temp_types" select="WebPage/Data/OptReturnData[@OptRetName='GetEmpCarTypeNames']/OptRetData/NewDataSet"></xsl:param>

    <xsl:for-each select="WebPage/Data/OptReturnData[@OptRetName='QueryEmpCarList']/OptRetData/NewDataSet/Rows">
    <xsl:if test="(position() mod 2)=0">
    <xsl:attribute name="class">Hover Bj</xsl:attribute>
    </xsl:if>

    <xsl:variable name="temp_driving_type" select="driving_type"/>
    <xsl:for-each select="$temp_types/Table">
    <xsl:choose>
    <xsl:when test="contains($temp_driving_type,id)">
    <option value="{id}" selected ="selected">
    <xsl:value-of select="name"/>
    </option>
    </xsl:when>
    </xsl:choose>
    </xsl:for-each>

    </xsl:for-each>

    </xsl:template>
    </xsl:stylesheet>


    个人博客地址:http://www.iwooto.com

  • 相关阅读:
    2018-8-10-win10-uwp-按下等待按钮
    2018-8-10-win10-uwp-按下等待按钮
    2019-6-23-win10-uwp-应用放到桌面
    2019-6-23-win10-uwp-应用放到桌面
    PHP mysqli_get_client_info() 函数
    PHP mysqli_get_charset() 函数
    PHP mysqli_free_result() 函数
    PHP mysqli_field_tell() 函数
    PHP mysqli_field_seek() 函数
    约束、视图、序列、伪列和索引
  • 原文地址:https://www.cnblogs.com/whoyou/p/5053389.html
Copyright © 2011-2022 走看看