[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Group problem with blank elements

Subject: Re: Group problem with blank elements
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Thu, 30 Jun 2005 22:55:53 -0700 (PDT)
failed to parse stylesheet
Hi Prakash,
  Your stylesheet look fine.. But when I run it with
Saxon 6.5.3, I get an error -

Error on line 2 column 6 of
file:/C:/xml/xsleg/xslt/posgroup1.xsl:
  Error reported by XML parser: The processing
instruction target matching "[xX]
[mM][lL]" is not allowed.
Transformation failed: Failed to parse stylesheet

Regards,
Mukul

--- omprakash.v@xxxxxxxxxxxxx wrote:

> 
> 
> 
> 
> 
> Hi,
> 
> The following xslt 1.0 stylesheet should work with a
> little tweaking. If
> there is an easier way to do this in 1.0, Iam not
> aware of it. probably
> much easier in xslt 2.0.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> <xsl:output method="xml" indent="yes" />
> 
> 
> <xsl:template match="/root">
> 
> <xsl:apply-templates select="statement-message[1]"
> mode="wrap"/>
> 
> </xsl:template>
> 
> <xsl:template match="statement-message" mode="wrap">
> 
> 
> <xsl:apply-templates
>
select="following-sibling::*[1][self::statement-message][not(string-length(following-sibling::*[self::statement-message])
>  = 0)][1]" mode="nowrap">
> <xsl:with-param name="parent" select="."/>
> <xsl:with-param name="dotag" select="0"/>
> </xsl:apply-templates>
> 
> <!--
> <xsl:apply-templates
>
select="following-sibling::*[1][self::statement-message]"
> mode="nowrap"/>
> -->
> 
> 
> </xsl:template>
> 
> <xsl:template match="statement-message[. = '']">
> 
> <xsl:value-of select="'here'"/>
> 
> <xsl:apply-templates
>
select="following-sibling::*[1][self::statement-message]"
> mode="wrap"/>
> </xsl:template>
> 
> 
> 
> <xsl:template match="statement-message"
> mode="nowrap">
> <xsl:param name="parent"/>
> <xsl:param name="dotag"/>
> 
> 
> <xsl:choose>
> <xsl:when test="number($dotag) = 0">
> 
> <statement-message>
> <xsl:value-of select="$parent"/>
> <xsl:value-of select="."/>
> 
> <xsl:choose>
> <!--
> <xsl:when
>
test="not(string-length(following-sibling::*[self::statement-message][1])
> =
> 0)">
> -->
> <xsl:when test="not(string-length(.) = 0)">
> 
> 
> <xsl:apply-templates
>
select="following-sibling::*[self::statement-message][not(string-length(following-sibling::*[self::statement-message])
>  = 0)][1]" mode="nowrap">
> <xsl:with-param name="parent" select="."/>
> <xsl:param name="dotag" select="1"/>
> </xsl:apply-templates>
> 
> </xsl:when>
> <xsl:otherwise>
> 
> <xsl:apply-templates select="statement-message"/>
> </xsl:otherwise>
> </xsl:choose>
> 
> </statement-message>
> </xsl:when>
> 
> 
> <xsl:otherwise>
> 
> <xsl:value-of select="."/>
> <xsl:apply-templates
>
select="following-sibling::*[self::statement-message][not(string-length(following-sibling::*[self::statement-message])
>  = 0)][1]" mode="nowrap"/>
> </xsl:otherwise>
> </xsl:choose>
> 
> <xsl:choose>
> <xsl:when
>
test="string-length(following-sibling::*[self::statement-message][1])
> = 0">
> 
> <xsl:apply-templates
>
select="following-sibling::*[1][self::statement-message]"
> mode="wrap"/>
> 
> </xsl:when>
> </xsl:choose>
> 
> 
> 
> <!--
> <xsl:apply-templates
>
select="following-sibling::*[self::statement-message][not(string-length(following-sibling::*[self::statement-message])
>  = 0)][1]" mode="wrap"/>
> -->
> 
> 
> </xsl:template>
> 
> <xsl:template match="statement-message[. = '']">
> 
> <xsl:value-of select="'here'"/>
> 
> <xsl:apply-templates
>
select="following-sibling::*[1][self::statement-message]"
> mode="wrap"/>
> 
> </xsl:template>
> 
> 
> </xsl:stylesheet>
> 
> 
> Hope this helps.
> 
> Cheers,
> prakash
> 
> 
> 
> 
> 
> 
>                                                     
>                                                     
>                              
>                       "Ed Yau"                      
>                                                     
>                              
>                       <eyau@vstrading.         To:  
>    <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                
>                              
>                       co.uk>                   cc:  
>    (bcc: omprakash.v/Polaris)                       
>                              
>                                               
> Subject:  Group problem with blank elements    
>                                    
>                       06/30/2005 11:00              
>                                                     
>                              
>                       PM                            
>                                                     
>                              
>                       Please respond                
>                                                     
>                              
>                       to xsl-list                   
>                                                     
>                              
>                                                     
>                                                     
>                              
>                                                     
>                                                     
>                              
> 
> 
> 
> 
> Hiya,
> 
> Having loads of trouble with this.  On the face of
> it a really easy
> problem.
> I have a bunch of elements like so:
> 
> <statement-message>Your account is now seriously in
> arrears.
> To</statement-message>
> 
> <statement-message>avoid further action a payment
> of</statement-message>
> 
> <statement-message>$82.00 is required immediately.
> Any</statement-message>
> 
> <statement-message>purchases will now be
> declined.</statement-message>
> 
> <statement-message>
> </statement-message>
> 
> <statement-message>  More text </statement-message>
> 
> <statement-message>
> </statement-message>
> 
> <statement-message>
> </statement-message>
> 
> <statement-message>
> </statement-message>
> 
> I want to strip out the empty tags and merge
> adjacent elements as
> follows:
> 
> <statement-message> Your account is now seriously in
> arrears. To avoid
> further action a payment of
> 82.00 is required immediately. Any purchases will
> now be
> declined.</statement-message>
> 
> <statement-message>  More text </statement-message>
> 
> My code at the moment is:
> <xsl:for-each-group select="statement-message"
>
group-ending-with="statement-message[string-length(normalize-space(follo
> wing-sibling::statement-message[1]))=0]">
>              <statement-message>
>                          <xsl:value-of select="."/>
>              </statement-message>
> </xsl:for-each-group>
> 
> My understanding of this is that it should start
> grouping from the 1st
> statement message, with the groups ending as soon as
> an empty element is
> reached.  The empty tags at the end would still be
> there, but at least
> it should do the merge.  However, the result looks
> like:
> 
>      <statement-message>Your account is now
> seriously in arrears.
> To</statement-message>
>      <statement-message>
>      </statement-message>
>      <statement-message>  More text
> </statement-message>
>      <statement-message>
>      </statement-message>
>      <statement-message>
>      </statement-message>
>      <statement-message>
>      </statement-message>
> 
> So where am I going wrong?
> 
> Ed
> 
> 
> 
> 
> 
> This e-Mail may contain proprietary and confidential
> information and is sent for the intended
> recipient(s) only. 
> If by an addressing or transmission error this mail
> has been misdirected to you, you are requested to
> delete this mail immediately.
> You are also hereby notified that any use, any form
> of reproduction, dissemination, copying, disclosure,
> modification,
> distribution and/or publication of this e-mail
> message, contents or its attachment other than by
> its intended recipient/s is strictly prohibited.
> 
> Visit Us at http://www.polaris.co.in
> 
> 



		
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.