[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xml nodes with spaces (at start, end, or just spaces) not showing correctly with xsl


Subject: RE: [xsl] xml nodes with spaces (at start, end, or just spaces) not showing correctly with xsl
From: "Andrew Madigan" <Andrew_Madigan@xxxxxxxxxxxxx>
Date: Thu, 17 Jun 2004 11:19:00 +0100

Hi Josh,

I keep getting failure notices, so I guess the file is too large so I
have striped out some of the xsl that does not deal with the same issue.

Here is a sample XML:
 <?xml version="1.0" encoding="UTF-8"?>

<LearningObject version="6">
  <LearningObjectProperties>
    <FileName/>
    <Duration/>
    <ObjectType>Flash</ObjectType>
    <LearningObjective>After completing this topic, you should be able
to </LearningObjective>
    <LearningPathCode/>
    <LearningPathTitle/>
    <ModuleCode/>
    <ModuleTitle/>
    <LearningEventCode/>
    <LearningEventTitle/>
    <LearningObjectCode/>
    <LearningObjectTitle/>
  </LearningObjectProperties>
  <LearningPoint type="conceptual" audioenabled="false">
    <Title/>
    <Slide type="textual">
      <Click type="text">
        <Text>The quick&lt;deleted&gt; brownfox
&lt;/deleted&gt;&lt;inserted&gt; brown fox &lt;/inserted&gt;jumped over
the fat lazy&lt;inserted&gt; &lt;/inserted&gt;dog.</Text>
      </Click>
    </Slide>
    <ObjectId></ObjectId>
  </LearningPoint>
</LearningObject>


And the striped down XSL:
<?xml version="1.0" encoding="ISO-8859-1"?> 

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


	<xsl:template match="LearningObject" >
	<xsl:for-each select="LearningPoint">
		<html>
		<head>
		<title>OSR report 1.1</title>
		<LINK REL="stylesheet" HREF="reports/css/mxml.css"
TYPE="text/css"/>
		</head><body>
		<font size="3" color="#000000">Learning
Point</font><hr/>
		<xsl:for-each select="Title[deleted]">
		   
		    Title (Deletion):
		    <br/>
		    <xsl:apply-templates/>
		   
		  </xsl:for-each>
		
		  <xsl:for-each select="Title[inserted]">
		   
		    Title (Insertion):
		    <br/>
		    <xsl:apply-templates/>
		   
  		</xsl:for-each>
		<xsl:apply-templates/>
		<br/>
		<br/>
		</body>
		</html>
		</xsl:for-each>
	</xsl:template>






 <xsl:template match="deleted"/>
 
 <xsl:template match="b">
 <b>
 <xsl:apply-templates/>
 </b>
 </xsl:template>
 
 
 
 
 <xsl:template match="p">
  <p/>
  <xsl:apply-templates/>
 </xsl:template>
 
 <xsl:template match="inserted">

   <xsl:apply-templates/>
 </xsl:template>
  
  <xsl:template match="br">
   <br/>
   <xsl:apply-templates/>
 </xsl:template>
 
 
 
 <xsl:template match="i">
  <i>
  <xsl:apply-templates/>
  </i>
 </xsl:template>
 
 <xsl:template match="font[@face='Courier New, Courier, mono']">
   <font face='Courier New, Courier, mono'>
   <xsl:apply-templates/>
   </font>
 </xsl:template>
 
 
 
 
 
<xsl:template match="Reply"/>

<xsl:template match="Slide[@type='textual']">

<b>Text Chunk</b>
<xsl:for-each select="Click[@type='text']">
<br/><font size="2" color="#FF0000">
<b><Script src="reports/js/row.js"/>
</b></font>
<br/><font size="2" color="#0000FF">Text Row:</font>
<br/>----- On Screen Text -----<br/>

  <xsl:for-each select="Text[deleted]">
  
    Deletion:
    <br/>
    <xsl:apply-templates/>
   
  </xsl:for-each>

  <xsl:for-each select="Text[inserted]">
   
    Insertion:
    <br/>
    <xsl:apply-templates/>
   
  </xsl:for-each>


<xsl:for-each select="Launch[@type='animation']">
----- Animation -----<br/>
<xsl:for-each select="Prompt/Content[deleted]">
   
    Prompt (Deletion):
    <br/>
    <xsl:apply-templates/>
   
  </xsl:for-each>
  <xsl:for-each select="Prompt/Content[inserted]">
   
    Prompt (Insertion):
    <br/>
    <xsl:apply-templates/>

  </xsl:for-each>
</xsl:for-each>

<xsl:for-each select="Launch[@type='windowlaunch']">
----- Launch Window -----<br/>
<xsl:for-each select="Prompt/Content[deleted]">
   
    Prompt (Deletion):
    <br/>
    <xsl:apply-templates/>
  
  </xsl:for-each>

  <xsl:for-each select="Prompt/Content[inserted]">
   
    Prompt (Insertion):
    <br/>
    <xsl:apply-templates/>

  </xsl:for-each>

</xsl:for-each>




<xsl:for-each select="Code[deleted]">
   <div id="alttext">
    Code (Deletion):
    <br/>
    <xsl:apply-templates/>
   </div>
  </xsl:for-each>

  <xsl:for-each select="Code[inserted]">
   <div id="alttext">
    Code (Insertion):
    <br/>
    <xsl:apply-templates/>
   </div>
  </xsl:for-each>


<xsl:for-each select="Syntax[deleted]">
   <div id="alttext">
    Syntax (Deletion):
    <br/>
    <xsl:apply-templates/>
   </div>
  </xsl:for-each>

  <xsl:for-each select="Syntax[inserted]">
   <div id="alttext">
    Syntax (Insertion):
    <br/>
    <xsl:apply-templates/>
   </div>
  </xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>




Thanks!
Andy

-----Original Message-----
From: Josh Canfield [mailto:Josh.Canfield@xxxxxxxxxxxx] 
Sent: 16 June 2004 18:15
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] xml nodes with spaces (at start, end, or just spaces)
not showing correctly with xsl

You have escaped the text inside of your Text element so that the XML
parser will treat it like text, therefore there are no <inserted> or
<deleted> elements, only a block of text.

Why are you escaping the contents of the <Text> element?

Also, your output is not what I would expect. I would expect to see the
"&lt;inserted&gt" make it into the output. Can you show a complete
template that outputs as you have described?

Josh



Current Thread
Keywords