如果子节点包含此文本,则提取属性值
Extract attribute value if child node contains this text
鉴于此 xml 输入:
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:doc="http://www.lyncode.com/xoai" xmlns:ore="http://www.openarchives.org/ore/terms/" xmlns:oreatom="http://www.openarchives.org/ore/atom/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2005/Atom http://www.kbcafe.com/rss/atom.xsd.xml">
<atom:id>http://hdl.handle.net/10862/152/ore.xml</atom:id>
<atom:link href="http://hdl.handle.net/10862/152" rel="alternate"/>
<atom:link href="http://hdl.handle.net/10862/152/ore.xml" rel="http://www.openarchives.org/ore/terms/describes"/>
<atom:link href="http://hdl.handle.net/10862/152/ore.xml#atom" rel="self" type="application/atom+xml"/>
<atom:published>2011-06-07T06:45:26Z</atom:published>
<atom:updated>2011-06-07T06:45:26Z</atom:updated>
<atom:source>
<atom:generator>SEAFDEC/AQD Institutional Repository</atom:generator>
</atom:source>
<atom:title>Field guide for the edible crustacea of the Philippines</atom:title>
<atom:author>
<atom:name>Motoh, Hiroshi</atom:name>
</atom:author>
<atom:category label="Aggregation" scheme="http://www.openarchives.org/ore/terms/" term="http://www.openarchives.org/ore/terms/Aggregation"/>
<atom:category scheme="http://www.openarchives.org/ore/atom/modified" term="2011-06-07T06:45:26Z"/>
<atom:category label="DSpace Item" scheme="http://www.dspace.org/objectModel/" term="DSpaceItem"/>
<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf" length="2310365" rel="http://www.openarchives.org/ore/terms/aggregates" title="ediblecrustacea.pdf" type="application/pdf"/>
<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf" length="177699" rel="http://www.openarchives.org/ore/terms/aggregates" title="edible-crust-errata.pdf" type="application/pdf"/>
<oreatom:triples>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="http://hdl.handle.net/10862/152/ore.xml#atom">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceItem"/>
<dcterms:modified>2011-06-07T06:45:26Z</dcterms:modified>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/35/edible-crust-errata.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/36/ediblecrustacea.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/32/ediblecrustacea.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/33/edible-crust-errata.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
</oreatom:triples>
</atom:entry>
我想提取 rdf:Description[@rdf:about]
的 第一次出现 的值,如果它的子节点包含 [=13] 中的 THUMBNAIL
的值=] 元素。所以在我上面的示例 xml 输入中,我想提取 https://repository.seafdec.org.ph/bitstream/10862/152/32/ediblecrustacea.pdf.jpg
编辑:
此 post 与我之前的 post 相关:
基本上,我想要实现的是将提取的值作为图像标签的src
。因此,在点击该反对票之前,请花点时间阅读链接 post。
提前致谢。
也许这会对你有所帮助:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<!-- You can use this XPath anywhere in the code. -->
<xsl:value-of select="//rdf:Description[boolean(@rdf:about) and
.//dcterms:description[. = 'THUMBNAIL']][1]/@rdf:about"/>
</xsl:template>
</xsl:stylesheet>
鉴于此 xml 输入:
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:doc="http://www.lyncode.com/xoai" xmlns:ore="http://www.openarchives.org/ore/terms/" xmlns:oreatom="http://www.openarchives.org/ore/atom/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2005/Atom http://www.kbcafe.com/rss/atom.xsd.xml">
<atom:id>http://hdl.handle.net/10862/152/ore.xml</atom:id>
<atom:link href="http://hdl.handle.net/10862/152" rel="alternate"/>
<atom:link href="http://hdl.handle.net/10862/152/ore.xml" rel="http://www.openarchives.org/ore/terms/describes"/>
<atom:link href="http://hdl.handle.net/10862/152/ore.xml#atom" rel="self" type="application/atom+xml"/>
<atom:published>2011-06-07T06:45:26Z</atom:published>
<atom:updated>2011-06-07T06:45:26Z</atom:updated>
<atom:source>
<atom:generator>SEAFDEC/AQD Institutional Repository</atom:generator>
</atom:source>
<atom:title>Field guide for the edible crustacea of the Philippines</atom:title>
<atom:author>
<atom:name>Motoh, Hiroshi</atom:name>
</atom:author>
<atom:category label="Aggregation" scheme="http://www.openarchives.org/ore/terms/" term="http://www.openarchives.org/ore/terms/Aggregation"/>
<atom:category scheme="http://www.openarchives.org/ore/atom/modified" term="2011-06-07T06:45:26Z"/>
<atom:category label="DSpace Item" scheme="http://www.dspace.org/objectModel/" term="DSpaceItem"/>
<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf" length="2310365" rel="http://www.openarchives.org/ore/terms/aggregates" title="ediblecrustacea.pdf" type="application/pdf"/>
<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf" length="177699" rel="http://www.openarchives.org/ore/terms/aggregates" title="edible-crust-errata.pdf" type="application/pdf"/>
<oreatom:triples>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="http://hdl.handle.net/10862/152/ore.xml#atom">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceItem"/>
<dcterms:modified>2011-06-07T06:45:26Z</dcterms:modified>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/35/edible-crust-errata.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/36/ediblecrustacea.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/32/ediblecrustacea.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/33/edible-crust-errata.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
</oreatom:triples>
</atom:entry>
我想提取 rdf:Description[@rdf:about]
的 第一次出现 的值,如果它的子节点包含 [=13] 中的 THUMBNAIL
的值=] 元素。所以在我上面的示例 xml 输入中,我想提取 https://repository.seafdec.org.ph/bitstream/10862/152/32/ediblecrustacea.pdf.jpg
编辑:
此 post 与我之前的 post 相关:
基本上,我想要实现的是将提取的值作为图像标签的src
。因此,在点击该反对票之前,请花点时间阅读链接 post。
提前致谢。
也许这会对你有所帮助:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<!-- You can use this XPath anywhere in the code. -->
<xsl:value-of select="//rdf:Description[boolean(@rdf:about) and
.//dcterms:description[. = 'THUMBNAIL']][1]/@rdf:about"/>
</xsl:template>
</xsl:stylesheet>