|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Finding a specific element and outputting another
On Tue, Jul 10, 2001 at 03:00:16PM -0400, Linda Zammit wrote: > Hello all, > I don't know if this is possible: > > I need to output the contents of one element dependant on the previous > elements content (i.e. if RemarkQualifier=DIMENSIONS then output '24 @ > 48"X48"X48"'. > > XML: > <Release> > <OrderRemark> > <RemarkQualifier>DIMENSIONS</RemarkQualifier> > <RemarkText>24 @ 48"X48"X48"</RemarkText> > </OrderRemark> > </Release> > <Release> > <OrderRemark> > <RemarkQualifier>PIECES</RemarkQualifier> > <RemarkText>24</RemarkText> > </OrderRemark> > </Release> First, list the processing expectations in detail: 1) From <RemarkText>, 2) examine the previous element's content, 3) when that element is a RemarkQualifer, 4) and when that element's content is 'DIMENSIONS' 5) display the contents of this element. Here's a solution: <xsl:template match="RemarkText"> <xsl:if test="preceding-sibling::RemarkQualifier[1][text()='DIMENSIONS']"> <xsl:value-of select="text()"/> </xsl:if> </xsl:template> That should do it. Z. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








