XML Tutorial

XML หน้าแรก บทนำ XML XML วิธีใช้งาน XML Tree ไวยากรณ์ XML องค์ประกอบ XML คุณสมบัติ XML XML เนมสเปซ จอแสดงผล XML XML HttpRequest XML Parser XML DOM XML XPath XML XSLT XML XQuery XML XLink เครื่องมือตรวจสอบ XML XML DTD XML Schema XML Server ตัวอย่าง XML แบบทดสอบ XML ใบรับรอง XML

XML AJAX

บทนำ AJAX AJAX XMLHttp คำขอ AJAX การตอบสนอง AJAX ไฟล์ AJAX XML AJAX PHP AJAX ASP ฐานข้อมูล AJAX แอปพลิเคชัน AJAX ตัวอย่าง AJAX

XML DOM

บทนำ DOM โหนด DOM การเข้าถึง DOM ข้อมูลโหนด DOM รายการโหนด DOM DOM Traversing การนำทาง DOM DOM รับค่า DOM เปลี่ยนโหนด DOM ลบโหนด DOM แทนที่โหนด DOM สร้างโหนด DOM เพิ่มโหนด DOM โคลนโหนด ตัวอย่าง DOM

บทช่วย สอนXPath

บทนำ XPath โหนด XPath ไวยากรณ์ XPath แกน XPath ตัวดำเนินการ XPath ตัวอย่าง XPath

กวดวิชาXSLT

บทนำ XSLT ภาษา XSL การแปลง XSLT XSLT <แม่แบบ> XSLT <ค่าของ> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <เลือก> ใช้ XSLT XSLT บนไคลเอนต์ XSLT บนเซิร์ฟเวอร์ XSLT แก้ไข XML ตัวอย่าง XSLT

กวดวิชาXQuery

บทนำ XQuery ตัวอย่าง XQuery XQuery FLWOR XQuery HTML ข้อกำหนด XQuery ไวยากรณ์ XQuery XQuery เพิ่ม XQuery Select ฟังก์ชัน XQuery

XML DTD

บทนำ DTD บล็อกตัวต่อ DTD องค์ประกอบ DTD คุณสมบัติ DTD องค์ประกอบ DTD เทียบกับ Attr หน่วยงาน DTD ตัวอย่าง DTD

ส คีมา XSD

บทนำ XSD XSD วิธีการ XSD <schema> องค์ประกอบ XSD แอตทริบิวต์ XSD ข้อจำกัด XSD

XSD Complex

องค์ประกอบ XSD XSD ว่างเปล่า องค์ประกอบ XSD เท่านั้น XSD Text เท่านั้น XSD ผสม ตัวชี้วัด XSD XSD <ใด ๆ> XSD <anyAttribute> การทดแทน XSD XSD ตัวอย่าง

ข้อมูลXSD

XSD สตริง วันที่ XSD XSD ตัวเลข XSD เบ็ดเตล็ด ข้อมูลอ้างอิง XSD

บริการเว็บ

XML Services XML WSDL XML SOAP XML RDF XML RSS

อ้างอิง

ประเภทโหนด DOM โหนด DOM DOM NodeList DOM NamedNodeMap เอกสาร DOM องค์ประกอบ DOM แอตทริบิวต์ DOM ข้อความ DOM DOM CDATA ความคิดเห็นของ DOM DOM XMLHttpRequest DOM Parser องค์ประกอบ XSLT ฟังก์ชัน XSLT/XPath

XSLT <xsl:number>


❮ ทำการอ้างอิงองค์ประกอบ XSLT ให้สมบูรณ์

ความหมายและการใช้งาน

<xsl:number> องค์ประกอบใช้เพื่อกำหนดตำแหน่งจำนวนเต็มของโหนดปัจจุบันในแหล่งที่มา นอกจากนี้ยังใช้เพื่อจัดรูปแบบตัวเลข


ไวยากรณ์

<xsl:number
count="expression"
level="single|multiple|any"
from="expression"
value="expression"
format="formatstring"
lang="languagecode"
letter-value="alphabetic|traditional"
grouping-separator="character"
grouping-size="number"/>

คุณลักษณะ

Attribute Value Description
count expression Optional. An XPath expression that specifies what nodes are to be counted
level single
multiple
any
Optional. Controls how the sequence number is assigned

Can be one of the following:

  • single (default)
  • multiple
  • any (not supported by Netscape 6)
from expression Optional. An XPath expression that specifies where the counting will start
value expression Optional. Specifies a user-provided number that is used in place of a sequence generated number
format formatstring Optional. Defines the output format for the number. Can be one of the following:
  • format="1" results in 1 2 3 . .
  • format="01" results in 01 02 03 (not supported by Netscape 6)
  • format="a" results in a b c . . (not supported by Netscape 6)
  • format="A" results in A B C. . (not supported by Netscape 6)
  • format="i" results in i ii iii iv . . (not supported by Netscape 6)
  • format="I" results in I II III IV . . (not supported by Netscape 6)
lang languagecode Optional. Specifies the language alphabet to be used for the numbering (Not supported by Netscape 6)
letter-value alphabetic
traditional
Optional. Specifies whether the numbering in the selected language is alphabetic or traditional. The default is alphabetic
grouping-separator character Optional. Specifies what character should be used to separate groups of digits. The default is the comma
grouping-size number Optional. Specifies how many digits are in the groups that are being separated by the character specified in the grouping-separator attribute. The default is 3

ตัวอย่าง 1

<xsl:number value="250000" grouping-separator="."/>

Output:

250.000

ตัวอย่าง 2

<xsl:number value="250000" grouping-size="2"/>

Output:

25,00,00

ตัวอย่างที่ 3

<xsl:number value="12" grouping-size="1"
grouping-separator="#" format="I"/>

Output:

X#I#I

ตัวอย่างที่ 4

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

<xsl:template match="/">
  <html>
  <body>
  <p>
  <xsl:for-each select="catalog/cd">
    <xsl:number value="position()" format="1" />
    <xsl:value-of select="title" /><br />
  </xsl:for-each>
  </p>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

❮ ทำการอ้างอิงองค์ประกอบ XSLT ให้สมบูรณ์