This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Unwanted Empty Elements from transformation


The most likely explanation is that your source XML contains
Foundation.Core.Class elements that do not contain a
Foundation.Core.ModelElement.name child. There are various easy ways to
fix it, but it's hard to be specific without knowing more about your
source document and your requirements.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com 




> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com 
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of 
> Raheem Rufai
> Sent: 05 July 2002 00:40
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Unwanted Empty Elements from transformation
> 
> 
> Hello Everyone,
> 
> I've got a problem with my stylesheet. Here it is:
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet 
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   version="1.0"
> >
> <xsl:output method="xml" indent="yes" encoding = 'ISO-8859-1' />
> 
> <xsl:template match="/">
>     <start>
>        <xsl:apply-templates select="//Foundation.Core.Class" />
>     </start>
> </xsl:template>
> <xsl:template match="Foundation.Core.Class">
>   <class>
>    <xsl:value-of select="Foundation.Core.ModelElement.name" />    
>   </class>
> </xsl:template>
> <xsl:template match="*" />
> </xsl:stylesheet>
> 
> While the template outputs the values expected of it, it also 
> outputs some annoying empty <class> elements. Here is a sample output:
> 
>   <?xml version="1.0" encoding="ISO-8859-1" ?> 
> - <start>
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class>ApplicantFile</class> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class>ApplicationDoc</class> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class>ApplicationForm</class> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class /> 
>   <class>DegreeRequirement</class> 
>   <class>Department</class> 
>   <class /> 
>   <class /> 
>   <class>EducationRecord</class> 
>   <class>EvaluationForm</class> 
>   <class>Major</class> 
>   <class /> 
>   <class /> 
>   <class>RecommendationLetter</class> 
>   <class>StandardizedTest</class> 
>   <class>User</class> 
>   <class><DummyClass></class> 
>   </start>
> 
> Please, somebody help me out. I'm completely clueless, what 
> the reason for this behaviour is. I've tried the code on both 
> saxon and xalan.
> 
> Thanks,
> 
> Raimi Rufai
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]