อิเล็กทรอนิกส์ <xsl:with-param> ของ XSLT

การกำหนดและการใช้งาน

อิเล็กทรอนิกส์ <xsl:with-param> กำหนดค่าที่ถูกส่งผ่านให้กับเทมเพลต

หมายเหตุ:ค่าของคุณสมบัติ name ของอิเล็กทรอนิกส์ <xsl:with-param> จะต้องตรงกับอิเล็กทรอนิกส์ <xsl:param> ในอีกของตัวแปร ไม่เช่นนั้นอิเล็กทรอนิกส์ <xsl:with-param> จะถูกละเลย

หมายเหตุ:<xsl:call-template> และ <xsl:apply-templates> ต่างใช้ได้ <xsl:with-param> อิเล็กทรอนิกส์

คำแนะนำ:คุณสามารถใช้เนื้อหาของอิเล็กทรอนิกส์ <xsl:with-param> หรือผ่านคุณสมบัติ select สำหรับกำหนดค่าของตัวแปร

ภาษา

<xsl:with-param name="name" select="expression">
  <!-- Content:template -->
</xsl:with-param>

คุณสมบัติ

คุณสมบัติ ค่า คำอธิบาย
name name ว่าด้วยความบริสุทธิ์ กำหนดชื่อของตัวแปร
select expression เลือกตามความต้องการ กำหนดรายการ XPath สำหรับค่าของตัวแปร

ตัวอย่าง

ตัวอย่าง 1

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="xx">
  <html>
  <body>
  <xsl:call-template name="show_title">
    <xsl:with-param name="title" />
  </xsl:call-template>
  </body>
  </html>
</xsl:variable>
<xsl:template name="show_title" match="/">
  <xsl:param name="title" />
  <xsl:for-each select="catalog/cd">
    <p>Title: <xsl:value-of select="$title" /></p>
  </xsl:for-each>
</xsl:template>
</xsl:stylesheet>