[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] current() - referring to top in nested predicates
<Urmel> <T>0</T> <T>6</T> <T>12</T> <T>18</T> <T>24</T> <B>15</B> <B>6</B> <B>7</B> <B>12</B> <B>9</B> <B>10</B> </Urmel> A <T> indicates a point in time. <T>s are ordered numerically. Direct siblings define an interval starting at the earlier <T> and ending before the later <T>. A <B> is an event scheduled for a point in time. I want to find all <T>s that start an interval which includes at least one event. All <T>s except the last one start an interval. The next following sibling ends the interval. This is easy. If the count of <B>s for the interval is zero, the interval is empty and I'm not interested; else I want it in the output. Determining emptiness isn't easy - yet. The following produces empty output and hence doesn't work, but you probably can see my intention. Using the current() function, I'm trying to refer to the current <T> to find out if the current <B> contained in $b falls within the bounds of the interval, but without success. This may fail because I'm nesting predicates and would need another variable instead of the current() function, but I can't figure out how to solve this, and maybe the problem can be reframed more intelligently. XSL 1.0 is required. <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:variable name="b" select="//B"/> <xsl:apply-templates select=" //T [ position() != last() ] [ count( $b[. >= current() and . < current()/following-sibling::T[1]]) > 0]"/> </xsl:template> <xsl:template match="T"> <xsl:value-of select="."/> <xsl:text> </xsl:text> </xsl:template> </xsl:transform> Michael Ludwig
|
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
|