[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Omit TEIForm and capture attributes of current nod
J.S.,
At 01:31 AM 9/25/2008, you wrote: XSL A couple of problems here: * Starting from the context inside for-each-group, "@rend" will not select the @rend attribute from the matched p element. Rather, the path would be "../@rend" or "parent::p/@rend". (Also there's a typo in the group-adjacent expression.) * The group-adjacent expression isn't going to work. You need an expression that will return a single atomic value for each node in the group. Presumably, the expression you want will give one value for lists and figures with IDs (putting adjacent ones into groups), another value for all other nodes (putting adjacent ones into groups). Then too, other improvements are also possible. <xsl:template match="p"> <xsl:variable name="p" select="."/> <xsl:for-each-group select="node()" group-adjacent="exists(self::list | self::figure[@id])"> <xsl:choose> <xsl:when test="current-grouping-key()"> <xsl:apply-templates select="current-group()"/> </xsl:when> <xsl:otherwise> <p> <xsl:copy-of select="$p/@rend"/> <xsl:copy-of select="current-group()"/> </p> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:template> The instruction <xsl:copy-of select="$p/@rend"/> will copy any @rend attribute on the p, but it will not create @rend attributes where there are none. (The variable here is only to make it clearer what is going on: "../@rend" would also work.) Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|