Subject: Re: [xsl] same content refuses to convert From: a kusa <akusa8@xxxxxxxxx> Date: Thu, 4 Mar 2010 10:30:53 -0600 |
Hi I have tried debugging this code with no luck! Michael, yes that intent is to create a <step2> for every <item> in <list2> . And list2 can have a nested list3. There is a typo in my code. Here is the corrected one. Sorry about that. <xsl:template match="list2"> <xsl:for-each select="item"> <step2> <text> <xsl:apply-templates select="*[not(following-sibling::list3)]"/> </text> </step2> <xsl:apply-templates select="following-sibling::*[1][not(self::item)]|list3|item"/> </xsl:for-each> </xsl:template> So if the content of an <item> is the same from the one following it, the second <item> is getting skipped. I just cannot figure out what the issue is here. Can someone please help me. On Tue, Mar 2, 2010 at 1:32 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote: >> What am I doing here that is making it skip the content is >> the content is duplicated? > > There's no obvious bug in the code you've shown us, though some of it looks > odd. If your list2 template is processed at all, then it will create a step2 > child for every item child in the input. > > Create a simplified example that demonstrates the problem but is complete, > so anyone can run it. You might find the bug while you're doing that, of > course. > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > >> -----Original Message----- >> From: a kusa [mailto:akusa8@xxxxxxxxx] >> Sent: 02 March 2010 19:19 >> To: xsl-list >> Subject: [xsl] same content refuses to convert >> >> Hi >> >> I have a very strange problem. I will try to explain it as >> effectively as possible. >> >> When I have the same content in the XML, it fails to transform. >> >> Example: >> >> My input looks like this: >> >> <list2> >> <item><text>First text</text></item> >> <item><text>Second text</text></item> >> <item><text>Third text</text></item> >> <item><text>First text</text></item> >> <item><text>Fourth text</text></item> >> <item><text>First text</text></item> >> </list2> >> >> Converted output: >> >> <step2> >> <text>First text</text> >> </step2> >> <step2> >> <text>Second text</text> >> </step2> >> <step2> >> <text>Third text</text> >> </step2> >> <step2> >> <text>Fourth text</text> >> </step2> >> >> As you can see the 'First text' content at the fourth and >> last item level is missing from the output. >> >> And in my XSLT which is rather long, all I am doing is a >> template match on list2, item, and a template match on text. >> >> <xsl:template match="list2"> >> <xsl:apply-templates select="*[not(following-sibling::list3)]"/> >> <xsl:for-each select="item"> >> <step2> >> <text> >> >> </text> >> >> </step2> >> <xsl:apply-templates >> select="following-sibling::*[1][not(self::item)]|list3|item"/> >> </xsl:for-each> >> >> >> </xsl:template> >> >> >> What am I doing here that is making it skip the content is >> the content is duplicated? >> >> Any help/suggestions is appreciated. >> >> Thanks in advance.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] same content refuses to c, Michael Kay | Thread | RE: [xsl] same content refuses to c, Michael Kay |
Re: [xsl] Math "functions" for XSLT, Dimitre Novatchev | Date | RE: [xsl] same content refuses to c, Michael Kay |
Month |