Announcement

Collapse
No announcement yet.

Selektionsproblem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Selektionsproblem

    Hallo, ich habe ein Selektionsproblem:

    Ich habe die folgende Ausgangsdatei (XML) (Auszug):

    Code:
    <w:p w:rsidR="00F27F7A" w:rsidRDefault="00F27F7A" w:rsidP="00F27F7A">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistlistintro"/>
    			</w:pPr>
    			<w:r>
    				<w:t xml:space="preserve">Eine </w:t>
    			</w:r>
    			<w:r w:rsidR="00E8112F">
    				<w:t>erste</w:t>
    			</w:r>
    			<w:r>
    				<w:t xml:space="preserve"> orientation-Listeneinführung</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="00E8112F" w:rsidRPr="00522BB4" w:rsidRDefault="00E8112F" w:rsidP="00F27F7A">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistlistintro"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Eine zweite orientation-Listeneinführung</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="00F27F7A" w:rsidRDefault="00F27F7A" w:rsidP="00F27F7A">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Hier kommt eine Ori-Liste!</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="00F27F7A" w:rsidRDefault="00F27F7A" w:rsidP="00F27F7A">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Noch eine Ori!</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="00F27F7A" w:rsidRDefault="00F27F7A" w:rsidP="00F27F7A">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Und noch eine Ori!</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="002B1686" w:rsidRDefault="002B1686" w:rsidP="002B1686">
    			<w:pPr>
    				<w:pStyle w:val="orientationparagraph"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Das ist ein Orientierungstext!</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="00176DD6" w:rsidRDefault="00E6247F" w:rsidP="00176DD6">
    			<w:pPr>
    				<w:pStyle w:val="orientationparagraph"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Das ist ein Orientierungstext!</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="004074C2" w:rsidRDefault="004074C2" w:rsidP="004074C2">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistlistintro"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Eine erste orientation-Listeneinführung 2</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="004074C2" w:rsidRPr="00522BB4" w:rsidRDefault="004074C2" w:rsidP="004074C2">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistlistintro"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Eine zweite orientation-Listeneinführung 2</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="004074C2" w:rsidRDefault="004074C2" w:rsidP="004074C2">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Hier kommt eine Ori-Liste! 2</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="004074C2" w:rsidRDefault="004074C2" w:rsidP="004074C2">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Noch eine Ori! 2</w:t>
    			</w:r>
    		</w:p>
    		<w:p w:rsidR="004074C2" w:rsidRPr="004074C2" w:rsidRDefault="004074C2" w:rsidP="004074C2">
    			<w:pPr>
    				<w:pStyle w:val="orientationlistitem"/>
    			</w:pPr>
    			<w:r>
    				<w:t>Und noch eine Ori! 2</w:t>
    			</w:r>
    		</w:p>

    Wie lautet der korrekte XPath-Befehl, um jeweils nur die zweite orientationlistlistintro zu selektieren (grün formatiert). Also immer die intro, nach der direkt die orientationlistitem folgen.

    Das folgende Match-Muster selektiert immer beide orientationlistlistintro. Igrendetwas fehlt?

    Code:
    match="w:p[w:pPr/w:pStyle[@w:val = 'orientationlistlistintro']]"
    Vielen Dank für eure Hilfe.

  • #2
    Hier ist ein Beispiel-Ausdruck, der prüft, ob das direkt vorgehende Element (preceding-sibling::*[1]) die Bedingung erfüllt:

    Code:
    w:p[w:pPr/w:pStyle[@w:val = 'orientationlistlistintro'] and preceding-sibling::*[1][self::w:p[w:pPr/w:pStyle[@w:val = 'orientationlistlistintro']]]]

    Comment


    • #3
      wenn aber jetzt evtl. viele orientationlistlistintro-Paragraphs kommen und ich immer nur den letzten haben will, nach dem eine orientationlistitem kommt, wie lautet dann der Ausdruck?

      Comment


      • #4
        Eventuell ist
        Code:
        w:p[w:pPr/w:pStyle[@w:val = 'orientationlistlistintro'] and following-sibling::*[1][self::w:p[w:pPr/w:pStyle[@w:val = 'orientationlistitem']]]]
        was du suchst.

        Comment


        • #5
          ja, vielen Dank.

          Comment

          Working...
          X