私は3つのxml構造を持っています。欠落している場合は要素を作成するか、要素が既に存在する場合はそれを選択して、要素を作成して均質化する必要があります。xsltで欠落しているxml要素を作成するにはどうすればよいですか?
Aは私が必要とする要素のほとんどを持っている構造:構造Bは、要素imprint
内部publisher
不足しているのに対し
<biblStruct>
<analytic>
<title type="label">Gronemann/Maaß/Peters/Schrader 2001</title>
<title type="titel">Körper und Schrift. Beiträge zum 16. Nachwuchskolloquium der
Romanistik, Leipzig, 14.-17. Juni 2000</title>
<idno>6677</idno>
<idno>6677</idno>
<author>
<persName>Gronemann, Claudia;Maaß, Christiane;Peters, Sabine A.;Schrader,
Sabine</persName>
</author>
</analytic>
<monogr>
<title type="label">Gronemann/Maaß/Peters/Schrader 2001</title>
<title type="titel">Körper und Schrift. Beiträge zum 16. Nachwuchskolloquium der
Romanistik, Leipzig, 14.-17. Juni 2000</title>
<idno type="standortsign">UB Bern;SUB Göttingen</idno>
<author>
<persName>Gronemann, Claudia;Maaß, Christiane;Peters, Sabine A.;Schrader,
Sabine</persName>
</author>
<imprint>
<publisher>Romanistischer Verlag</publisher>
<pubPlace>
<placeName>Bonn</placeName>
</pubPlace>
<date>2001</date>
</imprint>
</monogr>
<relatedItem type="enhalt">
<ref>Objekt 3257/Biographien-Werke</ref>
</relatedItem>
<note type="faustdb">biogra</note>
<note type="objektart">Bibliographie</note>
<note type="objektart">Bibliographie</note>
<note type="erstellt">
<date>2016-09-18T00:00:00.000</date>
</note>
<note type="letztebearb">
<date>2016-09-18T00:00:00.000</date>
</note>
</biblStruct>
:
<biblStruct>
<analytic>
<title type="label">Volmer 2001</title>
<title type="titel">Die Gebrechen des Lebens. Zur Körpererfahrung in
Korrespondenzen des 18. Jahrhunderts</title>
<idno>3257</idno>
<idno>3257</idno>
<author>
<persName>Volmer, Annett</persName>
</author>
</analytic>
<monogr>
<title type="label">Volmer 2001</title>
<title type="titel">Die Gebrechen des Lebens. Zur Körpererfahrung in
Korrespondenzen des 18. Jahrhunderts</title>
<idno type="standortsign">UB Basel: AP IX 5844</idno>
<author>
<persName>Volmer, Annett</persName>
</author>
<imprint>
<biblScope unit="sammelwerkin">Objekt 6677/Biographien-Werke</biblScope>
<biblScope unit="sammelwerkseiten">138-149</biblScope>
</imprint>
</monogr>
<note type="faustdb">biogra</note>
<note type="objektart">Bibliographie</note>
<note type="objektart">Bibliographie</note>
<note type="erstellt">
<date>2005-01-19T00:00:00.000</date>
</note>
<note type="letztebearb">
<date>2016-10-10T00:00:00.000</date>
</note>
<note type="kategorie">Briefkultur, Netzwerke,
Transfer;Wissen(schaft)sgeschichte/Medizin</note>
</biblStruct>
を、私はこのpublisher
要素を作成できるようにしたいと思いますそれが欠落している場合imprint
の中にネストされています - 私は非常に多様なエントリを含む巨大なリストを扱っています。
<monogr>
<imprint>
<publisher></publisher>
</imprint>
</monogr>
ので、出力がすべき:私は次の要素analytic
後に追加したいと思います。この場合、
<biblStruct>
<analytic>
<idno>24587</idno>
<idno>24587</idno>
<author>
<persName>Person aus Ref-Tabelle</persName>
</author>
</analytic>
<note type="faustdb">Publik</note>
<note type="objektart">Rezensionen</note>
<note type="objektart">Rezensionen</note>
</biblStruct>
:
同じでも、より多くの要素を欠いているCを、構造に適用されますbe:
<biblStruct>
<analytic>
<idno>24587</idno>
<idno>24587</idno>
<author>
<persName>Person aus Ref-Tabelle</persName>
</author>
</analytic>
<monogr>
<imprint>
<publisher></publisher>
</imprint>
</monogr>
<note type="faustdb">Publik</note>
<note type="objektart">Rezensionen</note>
<note type="objektart">Rezensionen</note>
</biblStruct>
要素が空であるかどうかは関係ありません彼は瞬間。どのように私はこれを達成することができますか?
これらのXMLエントリはすべて同じファイルにあり、まだソートできないことを覚えておいてください。すでに存在するか、まだ存在しない場合は、必要な要素を考慮して作成する必要があります。ありがとう!
データは利用できません。存在しない要素についてXPathを使用してドキュメントをクエリするのはエラーではなく、単に空のリストを返すだけではありません。空の要素を作成するのは、「その理由」がその原則に反するからです。これは問題ないですが、問題は本当に必要ですか?何のために? – Tomalak
ご意見ありがとうございます。私はそれらを作成したいと思うので、私は将来的に値で要素を埋めることを望んでいる。現時点では空になることができますが、私は検証のためにそれらを必要とします。 –
"*存在するかどうかを考慮して、必要な要素を作成する必要があります。*または、存在するかどうかにかかわらず、すべてを単純に作成することもできます。対応する値。テンプレートがテンプレートと呼ばれる理由があります。 –