[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Changing the structur of a file

Subject: Changing the structur of a file
From: "Madlik, Monika (LNG-VIE)" <Monika.Madlik@xxxxxxxxxxxxx>
Date: Wed, 24 Sep 2008 10:46:43 +0200
 Changing the structur of a file
Hi,

I've a problem structuring a file in a special way.

This is an excerpt of my XML-file:

<Document>
  <artikel>
    <meta.p>
      <fachgbt.p-alt>
        <fachgbt.a-alt kuerzel="QUAS">
          Qualitdtssicherung/Qualitdtsmanagement
        </fachgbt.a-alt>
      </fachgbt.p-alt>
    </meta.p>
    <artikel-allg>
      <stichwt.p>
        <stichwt.a>Ablaufdiagramm</stichwt.a>
      </stichwt.p>
      <inhalt.p>
        <variante.p>
          <uebers.engl.a>
            <gentext type="gerade">(engl.) </gentext>flow chart<gentext
type="gerade">;</gentext>
          </uebers.engl.a>
          <variante.syn.a>
            <gentext> syn. </gentext>Flussdiagramm<gentext>;</gentext>
          </variante.syn.a>
        </variante.p>
        <titel>Definition</titel>
        <bedeut.p>
          <bedeut.a>
            <gentext/>visuelle Darstellung von Prozessen in Form von
graphischen Symbolen mit Erlduterung;<gentext/>
          </bedeut.a>
          <bedeut.zus.a>
            <struk typ="verw" absatz="nein">
              <titel>Verwendung</titel>
                <text absatz="nein">z. B. im Qualitdtsmanagement.</text>
            </struk>
          </bedeut.zus.a>
        </bedeut.p>
      </inhalt.p>
    </artikel-allg>
  </artikel>
</Document>


I have to structure the file the way, that every <titel> becomes
<gliederung1>. But the second <titel> is not at the same hirarchy as the first
<titel>.

This is the excerpt how the XML-file should look like:

<gliederung1>
  <ueberschrift>Definition</ueberschrift>
  <absatz>visuelle Darstellung von Prozessen in Form von graphischen Symbolen
mit Erlduterung;</absatz>
</gliederung1>
<gliederung1>
  <ueberschrift>Verwendung</ueberschrift>
  <absatz>z. B. im Qualitdtsmanagement.</absatz>
</gliederung1>


I tried to solve this via xsl:key, but either I got no text or I got all text
including the text under the second title.
The second <title> is no problem, but the first <titel> is ...

This is a part of my XSLT-file:

<xsl:template match="titel">
  <xsl:choose>
    <xsl:when test="not(preceding::titel)">
	<gliederung1>
	  <ueberschrift><xsl:apply-templates/></ueberschrift>
	  <xsl:apply-templates select="key('immediate-nodes_t1', generate-id())"
mode="gl1"/>
	</gliederung1>
    </xsl:when>
    <xsl:when test="preceding::titel">
	<gliederung1>
	  <ueberschrift><xsl:apply-templates/></ueberschrift>
	  <xsl:apply-templates select="key('immediate-nodes_t2', generate-id())"
mode="gl1"/>
	</gliederung1>
    </xsl:when>
  </xsl:choose>
</xsl:template>

<xsl:key name="immediate-nodes_t1"
match="node()[following::node()[not(self::titel)]]"
use="generate-id(preceding-sibling::*[self::titel][1])"/>

<xsl:key name="immediate-nodes_t2"
match="node()[not(self::titel) and not(descendant::titel)]"
use="generate-id(preceding-sibling::*[self::titel][1])"/>


I hope I find somebody that could help me :)

Kind regards,
Monika

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.