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

Re: add elements

Subject: Re: add elements
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 6 Sep 2002 16:59:59 -0600 (MDT)
mike brown band
Naraschewski, E. wrote:
> First of all thank you very much for your answer!!!!!!!!!!
> 
> It nearly works now. The only problem left is, in my result file, the entries double. 

Sorry about that. You said your XML was like this

<entry>
  <MAT matid="687714453w">
    <Sachgebiete></Sachgebiete>
    <Fundstelle>
      <Band>1</Band>
      <Lektion>1</Lektion>
      <LektionsKategorie>X</LektionsKategorie>
      <AbsolutePos>1</AbsolutePos>
      <IndividPos>10816</IndividPos>
      <UbNummer>1</UbNummer>
    </Fundstelle>
  </MAT>
  <LO></LO>
</entry>

and you wanted to wrap the contents of 'entry' in a 'texteintrag' (as the only
child of 'entry') if the entry does not contain an 'UbNummer', right?

I misunderstood the format of your input and output (I thought you wanted the
'LO' to be outside of the 'texteintrag'), and I obviously gave you the wrong
answer anyway! I should have said this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="no"/>

  <!-- identity transform for all nodes -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!-- non-UbNummer entries get a texteintrag content wrapper -->
  <xsl:template match="entry[not(MAT/Fundstelle/UbNummer)]">
    <xsl:copy>  <!-- or just <entry> -->
      <texteintrag>
        <xsl:apply-templates/>
      </texteintrag>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.