Ich habe ein XML-Beispiel wie folgt:Wie man einen bestimmten Knoten Nachkomme Knoten zu durchqueren, basierend auf einigen anderen Abkömmling Wert
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic>
<table>...</table>
<p>...</p>
<ul>
<li>there is a tag
<b>
<u>HERE an XREF tag </u>
</b>has to be added after the fn tag that point to the fn id
<fn id="id-523">this is a second fn with id-523</fn>
</li>
<li>there is another third
<fn id="id-524">this is a third fn id-524</fn>
</li>
<li>there is another fourth
<fn id="id-525">this is a fourth fn id-525</fn>
<xref href="#topic_gtc_yn2_bcb/id-525" format="dita" type="fn"/>
</li>
<li>there is a xref tag that points to the fn id-523
<xref href="#topic_gtc_yn2_bcb/id-523" format="dita" type="fn"/>
</li>
</ul>
</topic>
Hier muss ich die ID überprüfen Attribut innerhalb des fn Tag vorhanden. Wenn ich dieser ID folge, habe ich ein xref -Tag innerhalb derselben ul (das kann auch für eine Tabelle oder ein ol-Element sein) dann entferne das ID-Attribut else I = wenn ich ein xref-Tag mit derselben ID habe (hier für zB id = 523). Dann muss ich Xref-Tag direkt nach diesem bestimmten Fn-Tag einführen.
Erwartete Ausgabe wird daher:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic>
<table>...</table>
<p>...</p>
<ul>
<li>there is another tag
<b>
<u>HERE an XREF tag </u>
</b>has to be added after the fn tag that point to the fn id
<fn id="id-523">this is a second fn with id-523</fn>
<xref href="#topic_gtc_yn2_bcb/id-523" format="dita" type="fn"/>
</li>
<li>there is another third
<fn>this is a third fn id-524</fn>
</li>
<li>there is another fourth <fn id="id-525">this is a fourth fn id-525</fn>
<xref href="#topic_gtc_yn2_bcb/id-525" format="dita" type="fn"/>
</li>
<li>there is a xref tag that points to the fn id-523
<xref href="#topic_gtc_yn2_bcb/id-523" format="dita" type="fn"/>
</li>
</ul>
</topic>
Als Ausgangspunkt, ich versuche etwas wie unten zu verwenden: xsl: otherwise> xsl: template> –
geek1209
Also haben Sie 'fn' Elemente in der XML-Eingabe oder einfach einen Text wie' < fn'? –
Ich muss es auf Tag anwenden –
geek1209