我試圖<ref type="biblical"/>在 TEI-XML 中獲取所有內容,看起來或多或少像這樣(來自專案的標題,一個<ref type="biblical" cRef="">包含以下內容的特定段落:
<?xml version="1.0" encoding="utf-8"?>
<!--<?xml-model href="../Customization/Schema_Quellentexte/religionsfrieden-quellentexte.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>--> <?xml-model href=""http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="edoc_ed000227_fg_augsburger_interim_zdt">
<teiHeader>
<fileDesc>
<titleStmt>
<title level="s">Europ?ische Religionsfrieden Digital</title>
<title level="a">Augsburger Interim (15. Mai / 30. Juni 1548) - Deutscher Text</title>
<principal ref="http://d-nb.info/gnd/111186870">Irene Dingel</principal>
<editor role="http://id.loc.gov/vocabulary/relators/edt" ref="http://orcid.org/0000-0002-1509-6960">Thomas St?cker</editor>
<editor role="http://id.loc.gov/vocabulary/relators/edt" ref="https://orcid.org/0000-0002-0801-5130">Andreas Zecherle</editor>
<editor role="http://id.loc.gov/vocabulary/relators/mrk">Silke Kalmer</editor>
</titleStmt>
<editionStmt>
<edition>Digitale Edition gem?? <ref target="http://www.tei-c.org/">TEI P5</ref></edition>
<funder>Deutsche Forschungsgemeinschaft</funder>
</editionStmt>
<publicationStmt>
<publisher>
<orgName ref="http://www.isni.org/0000000119314040">Akademie der Wissenschaften und Literatur Mainz</orgName>
</publisher>
<distributor change="#ch01">
<orgName ref="http://www.isni.org/0000000110101946">Universit?ts- und Landesbibliothek Darmstadt</orgName>
<idno type="ISIL">http://lobid.org/organisation/DE-17</idno>
</distributor>
<date when="2021-12-16" type="issued">2021</date>
<availability>
<licence target="https://creativecommons.org/licenses/by/4.0/">
<p xml:lang="en">This file is licensed under the terms of the Creative Commons License CC-BY 4.0 (Attribution 4.0 International)</p>
</licence>
</availability>
</publicationStmt>
<sourceDesc><!-- bitte ausfüllen; nicht zutreffende Elemente bitte rausl?schen -->
<msDesc>
<msIdentifier>
<settlement></settlement>
<repository></repository>
<collection></collection>
<idno>Signatur</idno>
<idno type="urn">urn:nbn:de:gbv:3:1-254930</idno>
<idno type="vd16">http://gateway-bayern.de/VD16 ZV 17728</idno>
</msIdentifier>
<msContents>
<msItem>
<title></title>
<respStmt>
<resp></resp>
<persName></persName>
</respStmt>
<biblStruct><!-- gilt nur für Drucke; rausnehmen, wenn es sich um ein Manuskript handelt! -->
<monogr xml:id="vorlage">
<imprint>
<pubPlace ref="http://www.geonames.org/2874225/mainz.html">Mainz</pubPlace>
<publisher>
<persName></persName>
</publisher>
<date>1548</date>
</imprint>
</monogr>
</biblStruct>
</msItem>
</msContents>
<history><!-- bei Manuskript, falls Datum und/oder Ort bekannt sind; andernfalls rausl?schen! -->
<origin>
<date></date>
<placeName></placeName>
</origin>
</history>
</msDesc>
</sourceDesc>
</fileDesc>
<encodingDesc>
<projectDesc>
<p>
<ref target="http://www.eured.de">Europ?ische Religionsfrieden Digital</ref>
</p>
</projectDesc>
<classDecl>
<taxonomy xml:id="marcrelator">
<bibl><idno type="URI">http://id.loc.gov/vocabulary/relators/</idno> MARC Code List for Relators </bibl>
</taxonomy>
</classDecl>
</encodingDesc>
<profileDesc>
<langUsage>
<language ident="deut">Deutsch</language><!-- Sprache hinzufügen -->
</langUsage>
</profileDesc>
<revisionDesc>
<change xml:id="ch01" when="2018-01-18"><p>Die Edition ist 2018 von der Herzog August Bibliothek Wolfenbüttel an die Universit?ts- und Landesbibliothek Darmstadt umgezogen.</p></change>
</revisionDesc>
</teiHeader>
<text>
<body>
<p facs="#facs_13_TextRegion_1624022922087_339">
<lb facs="#facs_13_line_1624022900872_333" n="N001"/>Da nun das<note type="crit_app"><bibl><ref type="bibl" target="#mehlhausen_augsburger_interim"><surname type="editor">Mehlhausen</surname>, Augsburger Interim</ref>, S. 36</bibl>: des.</note> menschen gemüt dermassen wol <w>zuge<pc>-</pc>
<lb facs="#facs_13_r2l14" n="N002"/><note place="margin-left" facs="#facs_13_TextRegion_1624023026742_369">
<lb facs="#facs_13_r1l2" n="N001"/>Eccle. 15.</note>richtet</w> was, <q>hat in Gott gelassen inn der hand seines <w>eig<pc>-</pc>
<lb facs="#facs_13_r2l15" n="N003"/>nen</w> Raths</q><note type="annotation"><ref type="biblical" cRef="Sir_15,14">Sir 15,14</ref>.</note>, Also weyt, das er nicht weniger macht hette
<lb facs="#facs_13_r2l16" n="N004"/>zu w?len das gut als das b?se. </p>
</body>
</text>
</TEI>
最初,我想在第一步中創建一個 HTML 表格,我退后一步,決定先做其他事情,因為我希望它最后是 CSV,我想,這是邁向好的一步那將只是創建一個包含所有元素的串列。(不是結構化串列,而是文本檔案中的一個接一個:-D):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tei ="http:www.tei-c.org/ns/1.0"
exclude-result-prefixes="xs"
version="3.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/tei:ref[@type='biblical']">
<!-- header -->
<xsl:text> Kürzel </xsl:text>
<!-- data -->
<xsl:for-each select="tei:ref[@type='biblical']">
<xsl:value-of select="@cRef"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
我對結果有點困惑:
源檔案位于命名空間http://www.tei-c.org/ns/1.0中,但沒有任何模板規則與此命名空間中的元素匹配(使用 --suppressXsltNamespaceCheck:on 來避免此警告)
I am using Saxon-EE 9.8.0.8 via Oxygen 20.0. I am still looking for a way to make this a table, but I can also use Python for this. (I am way more comfortable with Python!)
expected output is the part from the all @cRefattributes with the content for each @cRef on one line (the full result should contain roughly 300 entries):
Kürzel;
Sir_15,14;
{next entry}
...
I am at the moment recovering from Covid and thus having a hard time to concentrate, so be mild if I overlooked something too mundane! :-D
all the best, K
uj5u.com熱心網友回復:
如果您使用的是支持 XSLT 2.0 的處理器(例如 Saxon 9.x),那么您可以簡單地執行以下操作:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.tei-c.org/ns/1.0">
<xsl:output method="text"/>
<xsl:template match="/TEI">
<xsl:text>Kürzel; </xsl:text>
<xsl:value-of select="//ref[@type='biblical']/@cRef" separator="; "/>
</xsl:template>
</xsl:stylesheet>
uj5u.com熱心網友回復:
這是您可以執行此操作的一種方法:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tei ="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="xs"
version="3.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text"/>
<xsl:template match="/">
<!-- header -->
<xsl:text>Kürzel </xsl:text>
<!-- data -->
<xsl:apply-templates select="//tei:ref[@type='biblical']"/>
</xsl:template>
<xsl:template match="tei:ref[@type='biblical']">
<xsl:value-of select="@cRef"/>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
看到它在這里作業:https ://xsltfiddle.liberty-development.net/bF2MmYn
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/452393.html
上一篇:連接XML屬性SQLServer
下一篇:需要對xml檔案使用xslt轉換
