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

Re: Need help combing two elements

Subject: Re: Need help combing two elements
From: "Fatbob" <fatbob73@xxxxxxxxxxx>
Date: Sun, 29 Mar 2009 17:06:01 -0400
Re:  Need help combing two elements
Thanks for the reply Wendell, but man I really slow at understanding XSL.

You sample looks to be quick simple, yet I'm not getting the desired results. Perhaps it's because you're sample XML is quite a bit different than my sample.

Here again is my sample (I simplified it further from my previous email)...

<Row Type="Data">
<Cell>Mar 23, 2006</Cell>
<Cell>08:44</Cell>
</Row>

So how would your sample XSLT work with my sample XML?

Thanks!

----- Original Message ----- From: "Wendell Piez" <wapiez@xxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, March 27, 2009 4:05 PM
Subject: Re: Need help combing two elements



Fatbob:

Input:

<data>
  <one a="1"/>
  <two b="2"/>
</data>

XSLT:

<xsl:template match="data">
  <both a="{one/@a}" b="{two/@b}"/>
</xsl:template>

Output:
<both a="1" b="2"/>

Or more generally: decide on a context from which all the necessary data components for your new element are visible (any context will do but some are easier than others), and make the new element, pulling in whatever data you want from wherever you find it.

In fact, it's pretty hard to write XSLT that doesn't do this, in a very general way. If you think in terms of elements and attributes being nodes on a tree, rather than stuff written with tags (as you really must to get anywhere with XSLT), it starts seeming very normal.

Cheers,
Wendell

At 02:11 PM 3/27/2009, you wrote:
Thanks for taking the time to write that email. Greatly appreciate it.

To answer your question about moving to XSLT 2.0, unfortunately that is not
an option. So I'll have to find a solution to merging the two cells and
formatting the date using whatever functionality is available in 1.0.


So far I'm still in the dark as to how I can merge the cells.





====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.