[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Node test problem with preceding-sibling
Hi: I am trying to build a list of unique entries but somehow I am stuck with the node test. Seems like I am missing here some basic understanding. I tried lots of combination but I am not able to figure out the correct expression. The problematic part is the following: <xsl:variable name="unique-dates" select="/REPORT_ACCESS/REPORTS/REPORT /DATE[not(preceding-sibling::DATE = .)]" /> I am trying to get all unique dates. Currently I get the following output: Unique dates: 05/31/2005 05/30/2005 05/31/2005 05/30/2005 What I would expect is: Unique dates: 05/31/2005 05/30/2005 I know this is a trivial question, but currently I am stuck and I would really appreciate some friendly push in the right direction. Thanks in advance, Andreas My test XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" encoding="UTF-8" indent="no"/> <xsl:variable name="unique-dates" select="/REPORT_ACCESS/REPORTS/REPORT /DATE[not(preceding-sibling::DATE = .)]" /> <xsl:template match="REPORT_ACCESS"> <xsl:apply-templates select="REPORTS"></xsl:apply-templates> </xsl:template> <xsl:template match="REPORTS"> <xsl:message>Reports found</xsl:message> <!-- <xsl:apply-templates select="REPORT"></xsl:apply-templates> --> <xsl:for-each select="$unique-dates"> <xsl:message><xsl:value-of select="."/></xsl:message> </xsl:for-each> </xsl:template> <xsl:template match="REPORT"> <xsl:value-of select="DATE"></xsl:value-of> <xsl:text> - </xsl:text> <xsl:value-of select="preceding-sibling::REPORT/DATE"/> <xsl:text> || </xsl:text> </xsl:template> </xsl:stylesheet> ... and my test XML: <REPORT_ACCESS> <REPORTS> <REPORT> <REPORT_ID>755600996</REPORT_ID> <NAME>Monthly Performance Summary</NAME> <DESCRIPTION>Phone Bill Summary::Monthly Performance Summary</DESCRIPTION> <DISPLAY_TEXT>Monthly Performance Summary</DISPLAY_TEXT> <DATE>05/31/2005</DATE> <VERSION>01/09/2005</VERSION> <BATCH_BILL_START_DT>01/02/2005</BATCH_BILL_START_DT> <BATCH_BILL_END_DT>01/09/2005</BATCH_BILL_END_DT> <EFFECTIVE_DATE>05/31/2005</EFFECTIVE_DATE> <EXPIRATION_DATE>05/22/2012</EXPIRATION_DATE> <CLIENT_ID>364</CLIENT_ID> <CIC_ID>903</CIC_ID> <MODE>Premium</MODE> </REPORT> <REPORT> <REPORT_ID>546871065</REPORT_ID> <NAME>Monthly Performance Summary</NAME> <DESCRIPTION>Phone Bill Summary::Monthly Performance Summary</DESCRIPTION> <DISPLAY_TEXT>Monthly Performance Summary</DISPLAY_TEXT> <DATE>05/30/2005</DATE> <VERSION>01/16/2005</VERSION> <BATCH_BILL_START_DT>01/09/2005</BATCH_BILL_START_DT> <BATCH_BILL_END_DT>01/16/2005</BATCH_BILL_END_DT> <EFFECTIVE_DATE>05/31/2005</EFFECTIVE_DATE> <EXPIRATION_DATE>05/22/2012</EXPIRATION_DATE> <CLIENT_ID>364</CLIENT_ID> <CIC_ID>903</CIC_ID> <MODE>Premium</MODE> </REPORT> <REPORT> <REPORT_ID>563132464</REPORT_ID> <NAME>Monthly Performance Summary</NAME> <DESCRIPTION>Phone Bill Summary::Monthly Performance Summary</DESCRIPTION> <DISPLAY_TEXT>Monthly Performance Summary</DISPLAY_TEXT> <DATE>05/31/2005</DATE> <VERSION>01/23/2005</VERSION> <BATCH_BILL_START_DT>01/16/2005</BATCH_BILL_START_DT> <BATCH_BILL_END_DT>01/23/2005</BATCH_BILL_END_DT> <EFFECTIVE_DATE>05/31/2005</EFFECTIVE_DATE> <EXPIRATION_DATE>05/22/2012</EXPIRATION_DATE> <CLIENT_ID>364</CLIENT_ID> <CIC_ID>903</CIC_ID> <MODE>Premium</MODE> </REPORT> <REPORT> <REPORT_ID>136207414</REPORT_ID> <NAME>Monthly Performance Summary</NAME> <DESCRIPTION>Phone Bill Summary::Monthly Performance Summary</DESCRIPTION> <DISPLAY_TEXT>Monthly Performance Summary</DISPLAY_TEXT> <DATE>05/30/2005</DATE> <VERSION>01/30/2005</VERSION> <BATCH_BILL_START_DT>01/23/2005</BATCH_BILL_START_DT> <BATCH_BILL_END_DT>01/30/2005</BATCH_BILL_END_DT> <EFFECTIVE_DATE>05/31/2005</EFFECTIVE_DATE> <EXPIRATION_DATE>05/22/2012</EXPIRATION_DATE> <CLIENT_ID>364</CLIENT_ID> <CIC_ID>903</CIC_ID> <MODE>Premium</MODE> </REPORT> </REPORTS> </REPORT_ACCESS> -------------------------------------------------------- This electronic mail message contains information belonging to PaymentOne, which may be confidential and/or legal privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, printing, copying, distribution, or the taking of any action in reliance on the contents of this electronically mailed information is strictly prohibited. If you receive this message in error, please immediately notify us by electronic mail and delete this message. --------------------------------------------------------
|
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
|