Subject: Re: [xsl] block selection question (XSLT 1.0) From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Fri, 06 May 2011 11:44:49 +0200 |
I know that this is basic but I cannot get it done correctly.
Input: <lines> <line></line> <line>A1</line> <line>1</line> <line>B1</line> <line></line> <line>A2</line> <line>2</line> <line>2</line> <line>2</line> <line>B2</line> <line></line> <line></line> </lines>
Intended output (blockwise, start at A, all including next B): <line>A1</line> <line>1</line>
<line>A2</line> <line>2</line> <line>2</line> <line>2</line>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="@* | node()" name="identity"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
<xsl:template match="lines"> <xsl:apply-templates select="line[starts-with(., 'A')]"/> </xsl:template>
<xsl:template match="line[starts-with(., 'A')]"> <xsl:call-template name="identity"/> <xsl:apply-templates select="key('k1', generate-id())"/> </xsl:template>
I am however not sure whether the condition used "and node()" is what you want.
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] block selection question , Brandon Ibach | Thread | Re: [xsl] block selection question , Hermann Stamm-Wilbra |
Re: [xsl] block selection question , Brandon Ibach | Date | Re: [xsl] Looking for a concise way, Michael Kay |
Month |