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

Q: How to manipulate XML based on attribute?

Subject: Q: How to manipulate XML based on attribute?
From: "Timm, Sean" <STimm@xxxxxxxxxx>
Date: Wed, 19 Jul 2000 10:17:17 -0600
Q: How to manipulate XML based on attribute?
I've got the following XML file:
=============
<Page>
  <Person>
    <Name vip="true">John Smith</Name>
    <Friend>Joe Blow</Friend>
  </Person>
</Page>
=============

The vip attribute could occur on any element (this is a simplified structure
just for example purposes, so assume there could be many different elements
besides just these).  In other words, it could occur on the Person element,
or the Friend element, or not at all.

Wherever the vip attribute appears, I want to embed the result of whatever I
do with that element in <em></em> tags in the resultant HTML.  For the
example given above, I'd want the resultant HTML to look like the following:

<html>
  <body>
    <em><h1>John Smith</h1></em>
    Joe Blow
  </body>
</html>

So, obviously in the standard XSL, I'm embedding the Name element in a <h1>
tag.  However, since it specifies the vip attribute, I need to embed the
resultant manipulation of that tag in an <em> element.  Since I don't know
which element the attribute may appear on, I need a generic way to handle
it.

Is this possible?  What would the XSL need to look like to do this kind of
manipulation (especially where I don't know on which element the attribute
could occur)?

Thanks for your help!

- Sean T.


 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.