- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
首先,这是来自 my previous question 的衍生品。 .我再次发布此内容是因为 the person whose answer I accepted in the original post 建议我这样做因为他觉得这个问题以前没有正确定义。尝试2:
我正在尝试从 this webpage 中获取信息.为清楚起见,以下是 选择 页面源的 block :
<p class="titlestyle">ANT101H5 Introduction to Biological Anthropology and Archaeology
<span class='distribution'>(SCI)</span></p>
<span class='normaltext'>
Anthropology is the global and holistic study of human biology and behaviour, and includes four subfields: biological anthropology, archaeology, sociocultural anthropology and linguistics. The material covered is directed to answering the question: What makes us human? This course is a survey of biological anthropology and archaeology. [<span class='Helpcourse'
onMouseover="showtip(this,event,'24 Lectures')"
onMouseout="hidetip()">24L</span>, <span class='Helpcourse'
onMouseover="showtip(this,event,'12 Tutorials')"
onMouseout="hidetip()">12T</span>]<br>
<span class='title2'>Exclusion: </span><a href='javascript:OpenCourse("WEBCOURSENOTFOUND.html")'>ANT100Y5</a><br>
<span class='title2'>Prerequisite: </span><a href='javascript:OpenCourse("WEBCOURSEANT102H5.pl?fv=1")'>ANT102H5</a><br>
ANT101H5 Introduction to Biological Anthropology and Archaeology
Exclusion: ANT100Y5
Prerequisite: ANT102H5
sites = hxs.select("(//p[@class='titlestyle'])[2]/text()[1] | (//span[@class='title2'])[2]/text() | \
(//span[@class='title2'])[2]/following-sibling::a[1]/text() | (//span[@class='title2'])[3]/text() | \
(//span[@class='title2'])[3]/following-sibling::a[1]/text()")
[{"desc": "ANT101H5 Introduction to Biological Anthropology and Archaeology \n "},
{"desc": "Exclusion: "},
{"desc": "ANT100Y5"},
{"desc": "Prerequisite: "},
{"desc": "ANT102H5"}]
最佳答案
为所有类(class)选择相关数据所需的单个 XPath 表达式相当困惑 ,所以在这里我采用另一种方法,可以使用(如果有必要的话)生成单个 XPath 表达式:
这个简单的 XSLT 转换 :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="p[@class='titlestyle']">
<xsl:text>
===================
</xsl:text>
<xsl:value-of select="text()[1]"/>
</xsl:template>
<xsl:template match=
"span/span[@class='title2'][not(position() >1)]">
<xsl:text>
</xsl:text>
<xsl:value-of select="."/>
<xsl:value-of select="following-sibling::a[1]"/>
<xsl:if test="not(following-sibling::a)">
<xsl:value-of select="following-sibling::text()[1]"/>
</xsl:if>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
===================
Anthropology
===================
ANT101H5 Introduction to Biological Anthropology and Archaeology
Exclusion: ANT100Y5
===================
ANT102H5 Introduction to Sociocultural and Linguistic Anthropology
Exclusion: ANT100Y5
===================
ANT200Y5 World Archaeology and Prehistory
Prerequisite: 101H5
===================
ANT203Y5 Biological Anthropology
Prerequisite: 101H5
===================
ANT204Y5 Sociocultural Anthropology
Prerequisite: 101H5
===================
ANT205H5 Introduction to Forensic Anthropology
Prerequisite: 101H5
===================
ANT206Y5 Culture and Communication: Introduction to Linguistic Anthropology
Exclusion: ANT206H5
===================
ANT241Y5 Aboriginal Peoples of North America
===================
ANT299Y5 Research Opportunity Program
===================
ANT304H5 Anthropology and Aboriginal Peoples
Exclusion: ANT304Y5
===================
ANT306H5 Forensic Anthropology Field School
Prerequisite: ANT205H5
===================
ANT308H5 Case Studies in Archaeological Botany and Zoology
Prerequisite: ANT200Y5
===================
ANT309H5 Southeast Asian Archaeology
Prerequisite: ANT200Y5
===================
ANT310H5 Complex Societies
Prerequisite: ANT200Y5
===================
ANT312H5 Archaeological Analysis
Prerequisite: ANT200Y5
===================
ANT313H5 China, Korea and Japan in Prehistory
Prerequisite: ANT200Y5
===================
ANT314H5 Archaeological Theory
Exclusion: ANT411H5
===================
ANT316H5 South Asian Archaeology
Prerequisite: ANT200Y5
===================
ANT317H5 Archaeology of Eastern North America
Prerequisite: ANT200Y5
===================
ANT318H5 Archaeological Fieldwork
Prerequisite: ANT200Y5
===================
ANT320H5 Archaeological Approaches to Technology
Prerequisite: ANT200Y5
===================
ANT322H5 Anthropology of Youth Culture
Exclusion: ANT204Y5
===================
ANT327H5 Agricultural Origins: The Second Revolution
Prerequisite: ANT200Y5
===================
ANT331H5 The Biology of Human Sexuality
Exclusion: ANT330H5
===================
ANT332H5 Human Origins
Exclusion: ANT332Y5
===================
ANT333H5 Human Origins II
Exclusion: ANT332Y5
===================
ANT334H5 Human Osteology
Exclusion: ANT334Y5
===================
ANT335H5 Anthropology of Gender
Exclusion: ANT331Y5
===================
ANT336H5 Molecular Anthropology
Prerequisite: ANT203Y5
===================
ANT338H5 Laboratory Methods in Biological Anthropology
Prerequisite: ANT203Y5
===================
ANT339Y5 Human Adaptation through Biological and Cultural Means
Prerequisite: ANT203Y5
===================
ANT340H5 Osteological Theory
Exclusion: ANT334Y5
===================
ANT350H5 Globalization and the Changing World of Work
Prerequisite: ANT204Y5
===================
ANT351H5 Money, Markets, Gifts: Topics in Economic Anthropology
Prerequisite: ANT204Y5
===================
ANT352H5 Power, Authority, and Legitimacy: Topics in Political Anthropology
Prerequisite: ANT204Y5
===================
ANT358H5 Ethnographic Methods
Prerequisite: ANT204Y5
===================
ANT360H5 Anthropology of Religion
Exclusion: ANT209Y5
===================
ANT361H5 Anthropology of Sub-Saharan Africa
Exclusion: ANT212Y5
===================
ANT362H5 Language in Culture and Society
Prerequisite: ANT204Y5
===================
ANT363H5 Magic, Witchcraft and Science
Prerequisite: ANT360H5
===================
ANT364H5 Lab in Social Interaction
Prerequisite: ANT206H5
===================
ANT365H5 Semiotic Anthropology
Prerequisite: ANT204Y5
===================
ANT368H5 World Religions and Ecology
Exclusion: RLG311H5
===================
ANT369H5 Religious Violence and Nonviolence
Exclusion: RLG317H5
===================
ANT397H5 Independent Study
Prerequisite: Permission of Faculty Advisor
===================
ANT398Y5 Independent Reading
Prerequisite: Permission of Faculty Advisor
===================
ANT399Y5 Research Opportunity Program
Prerequisite: P.I.
===================
ANT401H5 Vocal and Visual Communication
Prerequisite: ANT102H5
===================
ANT414H5 People and Plants in Prehistory
Prerequisite: ANT200Y5
===================
ANT415H5 Faunal Archaeo-Osteology
Exclusion: ANT415Y5
===================
ANT416H5 Advanced Archaeological Analysis
Prerequisite: ANT312H5
===================
ANT418H5 Advanced Archaeological Fieldwork
Prerequisite: ANT318H5
===================
ANT430H5 Special Problems in Biological Anthropology and Archaeology
Prerequisite: P.I
===================
ANT430Y5 Special Problems in Biological Anthropology and Archaeology
Prerequisite: P.I.
===================
ANT431Y5 Special Problems in Sociocultural or Linguistic Anthropology
Prerequisite: P.I.
===================
ANT431H5 Special Problems in Sociocultural or Linguistic Anthropology
Prerequisite: P.I.
===================
ANT432H5 Special Seminar in Anthropology
Prerequisite: P.I.
===================
ANT433H5 Genes, Language, Artifact and Mind
Prerequisite: ANT200Y5
===================
ANT434H5 Palaeopathology
Prerequisite: ANT334Y5
===================
ANT438H5 The Development of Thought in Biological Anthropology
Prerequisite: ANT203Y5
===================
ANT439Y5 Advanced Forensic Anthropology
Prerequisite: ANT205H5
===================
ANT441H5 Advanced Bioarchaeology
Prerequisite: ANT334H5
===================
ANT457H5 Anthropology and the Environment
Prerequisite: ANT102H5
===================
ANT458H5 Anthropology of Crime, Law and Order
Exclusion: ANT204Y5
===================
ANT459H5 The Ethnography of Speaking
Prerequisite: ANT206Y5
===================
ANT460H5 Theory in Sociocultural Anthropology
Prerequisite: ANT204Y5
===================
ANT461H5 Emergent Topics in Socio-Cultural & Linguistic Anthropology
Prerequisite: ANT204Y5
===================
ANT498H5 Advanced Independent Study
Prerequisite: P.I.
===================
ANT499Y5 Advanced Independent Research
Prerequisite: P.I.
关于python - XPath:通过当前节点属性选择当前和下一个节点的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5208843/
你能比较一下属性吗 我想禁用文本框“txtName”。有两种方式 使用javascript,txtName.disabled = true 使用 ASP.NET, 哪种方法更好,为什么? 最佳答案 我
Count 属性 返回一个集合或 Dictionary 对象包含的项目数。只读。 object.Count object 可以是“应用于”列表中列出的任何集合或对
CompareMode 属性 设置并返回在 Dictionary 对象中比较字符串关键字的比较模式。 object.CompareMode[ = compare] 参数
Column 属性 只读属性,返回 TextStream 文件中当前字符位置的列号。 object.Column object 通常是 TextStream 对象的名称。
AvailableSpace 属性 返回指定的驱动器或网络共享对于用户的可用空间大小。 object.AvailableSpace object 应为 Drive 
Attributes 属性 设置或返回文件或文件夹的属性。可读写或只读(与属性有关)。 object.Attributes [= newattributes] 参数 object
AtEndOfStream 属性 如果文件指针位于 TextStream 文件末,则返回 True;否则如果不为只读则返回 False。 object.A
AtEndOfLine 属性 TextStream 文件中,如果文件指针指向行末标记,就返回 True;否则如果不是只读则返回 False。 object.AtEn
RootFolder 属性 返回一个 Folder 对象,表示指定驱动器的根文件夹。只读。 object.RootFolder object 应为 Dr
Path 属性 返回指定文件、文件夹或驱动器的路径。 object.Path object 应为 File、Folder 或 Drive 对象的名称。 说明 对于驱动器,路径不包含根目录。
ParentFolder 属性 返回指定文件或文件夹的父文件夹。只读。 object.ParentFolder object 应为 File 或 Folder 对象的名称。 说明 以下代码
Name 属性 设置或返回指定的文件或文件夹的名称。可读写。 object.Name [= newname] 参数 object 必选项。应为 File 或&
Line 属性 只读属性,返回 TextStream 文件中的当前行号。 object.Line object 通常是 TextStream 对象的名称。 说明 文件刚
Key 属性 在 Dictionary 对象中设置 key。 object.Key(key) = newkey 参数 object 必选项。通常是 Dictionary 
Item 属性 设置或返回 Dictionary 对象中指定的 key 对应的 item,或返回集合中基于指定的 key 的&
IsRootFolder 属性 如果指定的文件夹是根文件夹,返回 True;否则返回 False。 object.IsRootFolder object 应为&n
IsReady 属性 如果指定的驱动器就绪,返回 True;否则返回 False。 object.IsReady object 应为 Drive&nbs
FreeSpace 属性 返回指定的驱动器或网络共享对于用户的可用空间大小。只读。 object.FreeSpace object 应为 Drive 对象的名称。
FileSystem 属性 返回指定的驱动器使用的文件系统的类型。 object.FileSystem object 应为 Drive 对象的名称。 说明 可
Files 属性 返回由指定文件夹中所有 File 对象(包括隐藏文件和系统文件)组成的 Files 集合。 object.Files object&n
我是一名优秀的程序员,十分优秀!