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

Confusing namespaces and xslt

Subject: Confusing namespaces and xslt
From: "Paul Ferwerda" <pflists@xxxxxxxxx>
Date: Mon, 29 Sep 2008 14:36:42 -0400
 Confusing namespaces and xslt
I have a newbie question. I've gone round and around on this issue and
haven't been able to make any headway on my own. I suspect I'm missing
some basic understanding of how to use XPath expressions and how
namespaces are used. so I apologize in advance if the question is a
stupid one.

I need to handle the following xml and generate new xml that makes
some changes to some of the attributes;

<?xml version="1.0" encoding="UTF-8"?>
<box-client xmlns="somecompany.com/box/client"
xmlns:box="http://somecompany.com/box">
 <name>theclient</name>
 <description>theclient</description>
 <network>
   <box:host>host.somecompany.com</box:host>
   <box:components>
     <box:component>
       <box:name>Ports</box:name>
       <box:port>7801</box:port>
     </box:component>
   </box:components>
 </network>
 <logging>
   <box:rotation-time>24</box:rotation-time>
   <box:file-severity>info</box:file-severity>
 </logging>
 <use-connections>false</use-connections>
 <work-managers>
   <box:work-manager>
     <box:name>WM</box:name>
     <box:description>WM</box:description>
   </box:work-manager>
   <box:work-manager>
     <box:name>ClientRuntime-WM</box:name>
     <box:description>ClientRuntime-WM</box:description>
   </box:work-manager>
 </work-managers>
</box-client>

I inherited the above xml and am unable to  change it so I have to
figure out how to process what I've got.

I need to create a new xml file with a changed value for the
box:rotation-time and I need to add a new
<box:manager>ClientConnections</box:manager> element.

If I understand things correctly, the above xml declares a
somecompany.com/box/client namespace and a http://somecompany.com/box
namespace. I believe that the items in thesomecompany.com/box/client
name space are defined in a client.xsd file and the box items are
defined in a box.xsd file. I don't know why a prefix wasn't used for
the first namespace but it wasn't.

I'm having trouble figuring what xslt/xpath to use to access the
box:rotation-time element and what xslt to use to add in a new
<box:work-manager> inside the <work-managers> element. I'm confused as
to which namesp

If I can figure out the correct namespace I think I can use a for-each
to iterate through the elements and replace the ones I need to replace
or add in the one I need to add it.

Thanks!

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-2007 All Rights Reserved.