Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert to markdown for web/{xpath, xslt} zh-CN #6988

Merged
merged 3 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions files/zh-cn/web/xpath/axes/index.html

This file was deleted.

39 changes: 39 additions & 0 deletions files/zh-cn/web/xpath/axes/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Axes
slug: Web/XPath/Axes
tags:
- XPath
- XPath_Reference
translation_of: Web/XPath/Axes
---
{{ XsltRef() }} There are thirteen different axes in the [XPath](cn/XPath) specification. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree. The following is an extremely brief description of the thirteen available axes and the degree of support available in [Gecko](cn/Gecko).

For further information on using XPath expressions, please see the [For Further Reading](cn/Transforming_XML_with_XSLT/For_Further_Reading) section at the end of [Transforming XML with XSLT](cn/Transforming_XML_with_XSLT) document.

- [ancestor](cn/XPath/Axes/ancestor)
- : Indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node.
- [ancestor-or-self](cn/XPath/Axes/ancestor-or-self)
- : Indicates the context node and all of its ancestors, including the root node.
- [attribute](cn/XPath/Axes/attribute)
- : Indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (`@`).
- [child](cn/XPath/Axes/child)
- : Indicates the children of the context node. If an XPath expression does not specify an axis, is understood by default. Since only the root node or element nodes have children, any other use will select nothing.
- [descendant](cn/XPath/Axes/descendant)
- : Indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are **not** included - the `parent` of an `attribute` node is an element node, but `attribute` nodes are not the children of their parents.
- [descendant-or-self](cn/XPath/Axes/descendant-or-self)
- : Indicates the context node and all of its descendants. Attribute and namespace nodes are **not** included - the `parent` of an `attribute` node is an element node, but `attribute` nodes are not the children of their parents.
- [following](cn/XPath/Axes/following)
- : Indicates all the nodes that appear after the context node, except any `descendant`, `attribute`, and `namespace` nodes.
- [following-sibling](cn/XPath/Axes/following-sibling)
- : Indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
- [namespace](cn/XPath/Axes/namespace)
_(not supported)_
- : Indicates all the nodes that are in scope for the context node. In this case, the context node must be an element node.
- [parent](cn/XPath/Axes/parent)
- : Indicates the single node that is the parent of the context node. It can be abbreviated as two periods (`..`).
- [preceding](cn/XPath/Axes/preceding)
- : Indicates all the nodes that precede the context node in the document except any `ancestor`, `attribute` and `namespace` nodes.
- [preceding-sibling](cn/XPath/Axes/preceding-sibling)
- : Indicates all the nodes that have the same parent as the context node and appear before the context node in the source document.
- [self](cn/XPath/Axes/self)
- : Indicates the context node itself. It can be abbreviated as a single period (`.`).
44 changes: 0 additions & 44 deletions files/zh-cn/web/xpath/comparison_with_css_selectors/index.html

This file was deleted.

18 changes: 18 additions & 0 deletions files/zh-cn/web/xpath/comparison_with_css_selectors/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Comparison of CSS Selectors and XPath
slug: Web/XPath/Comparison_with_CSS_selectors
translation_of: Web/XPath/Comparison_with_CSS_selectors
original_slug: Web/CSS/CSS_Selectors/Comparison_with_XPath
---
{{CSSRef("Selectors")}}{{QuickLinksWithSubpages("/en-US/docs/Web/XPath")}}

本文旨在记录 CSS 选择器和 XPath 之间的区别,以便 Web 开发人员能够更好地为正确的工作选择合适的工具。

| [XPath feature](/en-US/docs/Web/XPath) | [CSS equivalent](/en-US/docs/Web/CSS/CSS_Selectors) |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`ancestor`](/en-US/docs/Web/XPath/Axes/ancestor), [`parent`](/en-US/docs/Web/XPath/Axes/parent) or [`preceding-sibling`](/en-US/docs/Web/XPath/Axes/preceding-sibling) axis | {{CSSxRef(":has",":has()")}} selector {{experimental_inline}} |
| [`attribute`](/en-US/docs/Web/XPath/Axes/ancestor) axis | [Attribute selectors](/en-US/docs/Web/CSS/Attribute_selectors) |
| [`child`](/en-US/docs/Web/XPath/Axes/child) axis | [Child combinator](/en-US/docs/Web/CSS/Child_selectors) |
| [`descendant`](/en-US/docs/Web/XPath/Axes/descendant) axis | [Descendant combinator](/en-US/docs/Web/CSS/Descendant_selectors) |
| [`following-sibling`](/en-US/docs/Web/XPath/Axes/following-sibling) axis | [General sibling combinator](/en-US/docs/Web/CSS/General_sibling_selectors) or [adjacent sibling combinator](/en-US/docs/Web/CSS/Adjacent_sibling_selectors) |
| [`self`](/en-US/docs/Web/XPath/Axes/self) axis | {{CSSxRef(":scope")}} or {{CSSxRef(":host")}} selector |
54 changes: 0 additions & 54 deletions files/zh-cn/web/xpath/index.html

This file was deleted.

Loading