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

RE: gathering entities when transforming

Subject: RE: gathering entities when transforming
From: cknell@xxxxxxxxxx
Date: Wed, 22 Jun 2005 16:47:33 -0400
2361c stylesheets
I left out the processing instructions to save space. Here is a stylesheet that does what you ask for.

<?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="yes" encoding="UTF-8" />
  <xsl:strip-space elements="*" />

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="diagnosticwp">
    <xsl:copy>
      <xsl:for-each select="@*">
        <xsl:copy />
      </xsl:for-each>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="statemanipulation">
    <xsl:copy>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="string">
    <expression>
      <xsl:copy-of select="." />
    </expression>
  </xsl:template>

</xsl:stylesheet>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Carolyn Oliver <Coliver@xxxxxxxxx>
Sent:     Wed, 22 Jun 2005 16:12:11 -0400
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:   gathering entities when transforming

I have an XML file that I need to add another layer of elements to.  The
XML currently is:

<?xml version="1.0" encoding="utf-8"?>
<!--ArborText, Inc., 1988-2002, v.4002-->
<!DOCTYPE diagnosticwp SYSTEM
"Production_Rev_3061_MIL-STD-40051-2361C.dtd"[
<!ENTITY obj.5  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\CHORD.wmf" NDATA WMF>
<!ENTITY obj.6  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8801.wmf" NDATA
WMF>
<!ENTITY obj.7  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8802.wmf" NDATA
WMF>
<!ENTITY obj.8  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8801.wmf" NDATA
WMF>
<!ENTITY obj.9  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8802.wmf" NDATA
WMF>
<!ENTITY obj.10  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8803.wmf" NDATA
WMF>
]>
<?Pub Inc?>
<diagnosticwp wpno="e88-20">
<statemanipulation>
<string>foobar</string>
</statemanipulation>
</diagnosticwp>
..

What I want is:

<?xml version="1.0" encoding="utf-8"?>
<!--ArborText, Inc., 1988-2002, v.4002-->
<!DOCTYPE diagnosticwp SYSTEM
"Production_Rev_3061_MIL-STD-40051-2361C.dtd"[
<!ENTITY obj.5  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\CHORD.wmf" NDATA WMF>
<!ENTITY obj.6  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8801.wmf" NDATA
WMF>
<!ENTITY obj.7  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8802.wmf" NDATA
WMF>
<!ENTITY obj.8  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8801.wmf" NDATA
WMF>
<!ENTITY obj.9  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8802.wmf" NDATA
WMF>
<!ENTITY obj.10  SYSTEM "G:\EMS2\FMTV20\GRAPHICS\E\R2e8803.wmf" NDATA
WMF>
]>
<?Pub Inc?>
<diagnosticwp wpno="e88-20">
<statemanipulation>
<expression>                                   <<<< new tag
<string>foobar</string>
</expression>
</statemanipulation>
</diagnosticwp>
..

How do I get the entities in my new file?  If I do a copy-of the root,
I'll get the entire file won't I?  Just using the copy is giving me:

<?xml version="1.0" encoding="utf-8"?>
<!--ArborText, Inc., 1988-2002, v.4002-->
<!DOCTYPE diagnosticwp SYSTEM
"Production_Rev_3061_MIL-STD-40051-2361C.dtd">
<?Pub Inc?>
<diagnosticwp wpno="e88-20">
<statemanipulation>
<expression>
<string>foobar</string>
</expression>
</statemanipulation>
</diagnosticwp>
..

Thanks for any help you can offer.

Carolyn



**********************************************************************
Confidentiality Notice
The information contained in this e-mail is confidential and intended for
use only by the person(s) or organization listed in the address. If you have
received this communication in error, please contact the sender at O'Neil &
Associates, Inc., immediately. Any copying, dissemination, or distribution
of this communication, other than by the intended recipient, is strictly
prohibited.
**********************************************************************

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.