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

RE: rendering marginal XML

Subject: RE: rendering marginal XML
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Fri, 26 Oct 2001 16:09:26 -0400
RE:  rendering marginal XML
> > <msgSent>
> > 	<time>time sent</time>
> > 	<origin>me@xxxxxxxx</origin>
> > 	<r>you@xxxxxxxxx</r>
> > 	<recieved>time recieved</recieved>
> > 	<status>Any error messages, etc</status>
> > 	<r>you2@xxxxxxxxx</r>
> > 	<recieved>time recieved</recieved>
> > 	<status>Any error messages, etc</status>
> > 	(this repeats for each recipient)
> > </msgSent>
> > (this repeats for each message)
> >
> > The problem is the <recieved> and <status> tags refer to the
> > imediately preceding <r> tag.
> 
> If the structure is sufficiently regular you can add the necessary
> <recipient> element by doing
> 
> <xsl:template match="r">
>   <recipient>
>   <name><xsl:value-of select="."/></name>
>   <received><xsl:value-of
> select="following-sibling::recieved[1]"/></received>
>   <status><xsl:value-of 
> select="following-sibling::status[1]"/></status>
>   </recipient>
> </xsl:template>
> 

Or, to deal with missing Status elements:

<xsl:template match="r">
 <xsl:if test="string(following-sibling::*[2]/self::*[name(.)='status'])">
  <recipient>
  <name><xsl:value-of select="."/></name>
  <received><xsl:value-of
select="following-sibling::recieved[1]"/></received>
  <status><xsl:value-of select="following-sibling::status[1]"/></status>
  </recipient>
 </xsl:if>
</xsl:template>

David.
--
David McNally
Software Engineer
Moody's Investors Service

 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.