Subject: RE: [xsl] rendering marginal XML From: "Chris Bayes" <chris@xxxxxxxxxxx> Date: Fri, 26 Oct 2001 21:32:36 +0100 |
David, That wouldn't deal with <msgs> <msgSent> <time>time sent</time> <origin>me@xxxxxxxx</origin> <r>you1@xxxxxxxxx</r> <aFewOtherVariousTagsThatAppear /> <recieved>1time recieved</recieved> <orDoNotAppear /> <basedOnSeveralConditions /> <orDoNotAppear /> <basedOnSeveralConditions /> <status>Any error messages, etc</status> <r>you2@xxxxxxxxx</r> <recieved>2time recieved</recieved> <orDoNotAppear /> <basedOnSeveralConditions /> <r>you3@xxxxxxxxx</r> <recieved>3time recieved</recieved> <orDoNotAppear /> <basedOnSeveralConditions /> <orDoNotAppear /> <basedOnSeveralConditions /> <orDoNotAppear /> <basedOnSeveralConditions /> <r>you4@xxxxxxxxx</r> <recieved>4time recieved</recieved> <status>Any error messages, etc</status> <r>you5@xxxxxxxxx</r> <recieved>5time recieved</recieved> <aFewOtherVariousTagsThatAppear /> <orDoNotAppear /> <basedOnSeveralConditions /> </msgSent> </msgs> Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > McNally, David > Sent: 26 October 2001 21:09 > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: RE: [xsl] 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 > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] rendering marginal XML, McNally, David | Thread | [xsl] String Manipulation in XSL, Peter . FLYNN |
[xsl] ANN: Internet-live XML-relate, G. Ken Holman | Date | Re: [xsl] Using style sheet to disp, Jörg Heinicke |
Month |