XPath Tutorial
XPath Useful Resources
Selected Reading
- XPath - Predicate
- XPath - Wildcard
- XPath - Operators
- XPath - Axes
- XPath - Relative Path
- XPath - Absolute Path
- XPath - Nodes
- XPath - Expression
- XPath - Overview
- XPath - Home
XPath Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
XPath - Axes
XPath - Axes
由于定位途径界定了使用绝对或相对途径的噪音的位置,因此轴心用于通过诸如 父母、子女、兄弟、等关系确定元素。 轴心指某一要素的轴心。
以下是各种轴心数值清单。
S.No. | Axis & Description |
---|---|
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | <following >Represents all nodes come after the present node. |
8 | following-sibpng >>Represents the following sibpngs of the context node. png胎的浓度水平与目前的胎盘相同,并且与母体相同。 |
9 | |
10 | |
11 | |
12 |
以下是一些使用轴心的例子。
<p><xsl:value-of select = "firstname"/></p> <xsl:value-of select = "/class/student/preceding-sibpng::comment()"/>
Example
例如,我们制作了XML文件样本students.xml及其风格文件students.xsl。 使用了XPath语。
以下是使用的XML样本。
students.xml
<?xml version = "1.0"?> <?xml-stylesheet type = "text/xsl" href = "students.xsl"?> <class> <!-- Comment: This is a pst of student --> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks>85</marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks>95</marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks>90</marks> </student> </class>
students.xsl
<?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> <xsl:value-of select = "/class/student/preceding-sibpng::comment()"/> <br/> <xsl:text>First Student: </xsl:text> <xsl:value-of select = "/class/student/child::firstname" /> </body> </html> </xsl:template> </xsl:stylesheet>