我已经能够在没有元数据架构的 xml 文档中使用此公式成功地将“pbcoreRightsSummary”标签更改为“notes”:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="pbcoreRightsSummary">
<notes>
<xsl:apply-templates select="node()|@*"/>
</notes>
</xsl:template>
</xsl:stylesheet>
但是当我将它应用于具有这些规范的文档时:
xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html
http://pbcore.org/xsd/pbcore-2.0.xsd"
我什么都得不到。请指教?
UPDATE:
因此,我将命名空间添加到 XSLT,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html http://pbcore.org/xsd/pbcore-2.0.xsd">
<xsl:output method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="pbcoreRightsSummary">
<notes>
<xsl:copy-of select="node()|@*"/>
</notes>
</xsl:template>
</xsl:stylesheet>
但我似乎仍然无法更改此文档(我使用 Oxygen XML Editor 14.0):
<?xml version="1.0" encoding="utf-8"?>
<pbcoreCollection xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html http://pbcore.org/xsd/pbcore-2.0.xsd">
<pbcoreDescriptionDocument>
<pbcoreAssetType>Media Object</pbcoreAssetType>
<pbcoreAssetDate dateType="Created">1970</pbcoreAssetDate>
<pbcoreIdentifier source="CAVPP" annotation="Object Identifier">000028</pbcoreIdentifier>
<pbcoreTitle titleType="Main">Case for Population Control</pbcoreTitle>
<pbcoreTitle titleType="Series"/>
<pbcoreDescription/>
<pbcoreRightsSummary>
<rightsSummary annotation="Copyright Statement">Digital recordings from this collection may be accessed freely. </rightsSummary>
</pbcoreRightsSummary>
</pbcoreDescriptionDocument>
</pbcoreCollection>