The code of the tagger file is the following

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="text()">
    <xsl:value-of disable-output-escaping="yes" select="."/>
  </xsl:template>
  <xsl:template priority="-1"
                match="@* | * | text() | processing-instruction() |
comment()">
    <!-- Identity transformation. -->
    <xsl:copy>
      <xsl:apply-templates
           select="@* | * | text() | processing-instruction() | comment()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

and of the nonamespace.xsl is
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  >
 
  <xsl:template match="*" priority="-1">
    <xsl:choose>
      <xsl:when test="namespace-uri()=''">
        <!-- assume if namespace empty, namespace = xhtml -->
        <xsl:element name="{name()}">
          <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
      </xsl:when>
      <xsl:otherwise>
        <xsl:element name="{local-name()}">
          <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 
  <xsl:template match="@*|comment()">
    <xsl:copy/>
  </xsl:template>
 
</xsl:stylesheet>


manuel

Jasha Joachimsthal escribió:
I Manuel,
 
what does the tagger.xsl look like?
Does it do something like <xsl:element><xsl:value-of select="substring-before(substring-after(stringpart,'lt;'),'gt;')"/></xsl:element>?
 
Jasha
-----Original Message-----
From: Manuel Ottaviano [mailto:[EMAIL PROTECTED]]
Sent: dinsdag 12 september 2006 12:57
To: [email protected]
Subject: XSLT Transformer Problem: STILL I'm Lost :(

Hello Cocoon World I contact you again because I'm desperate....

I've a match process inside a pipeline that receives XML data from a Web Service , it merges with other translated data.

After this process the results is :


<?xml version="1.0" encoding="ISO-8859-1"?>
<page xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<meta-data>Castelano</meta-data>
   &lt;data&gt;
	&lt;product&gt;Hearth Failure Management&lt;/product&gt;
	&lt;error_code&gt;200&lt;/error_code&gt;
    
	&lt;command&gt;List of Patient&lt;/command&gt;
	&lt;rows&gt;
		&lt;row&gt;
			&lt;status&gt;Alert!&lt;/status&gt;
			&lt;surname&gt;Rodriguez&lt;/surname&gt;
    
			&lt;name&gt;Manuel&lt;/name&gt;
			&lt;chn&gt;1234556789&lt;/chn&gt;
			&lt;age&gt;60&lt;/age&gt;
			&lt;gender&gt;F&lt;/gender&gt;
    
			&lt;lastSeen&gt;lastSeen&lt;/lastSeen&gt;
			&lt;patientID&gt;1563&lt;/patientID&gt;
		&lt;/row&gt;
    
	&lt;/rows&gt;
&lt;/data&gt;
    
</page>
I want to transform this result in a XHTML table.
I add the 3 following stylesheet:
  • tagger.xsl that transform < > html codes in  ><
  • nonamespace.xsl  that removes namespaces
This is the partial result :

<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<meta-data>Castelano</meta-data>
   <data>
	<product>Hearth Failure Management</product>
	<error_code>200</error_code>
	<command>List of Patient</command>
	<rows>
    
		<row>
			<status>Alert!</status>
			<surname>Rodriguez</surname>
			<name>Manuel</name>
			<chn>1234556789</chn>
			<age>60</age>
    
			<gender>F</gender>
			<lastSeen>lastSeen</lastSeen>
			<patientID>1563</patientID>
		</row>

    
	</rows>
</data>

</page>
  • table.xsl is the styleshhet to format the table. I use this code:
<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:template match="page">
  <html>  <body>       <xsl:apply-templates/>  </body></html>
  </xsl:template>
 <xsl:template match="rows">
    <table border="1">    <tbody>   <tr>  <th></th>  </tr>   </tbody>
     <xsl:apply-templates/>
             </table>
      </xsl:template>
   <xsl:template match="row">
    <tr><xsl:apply-templates/></tr>
      </xsl:template>
 <xsl:template match="status">
    <td>     <xsl:apply-templates/>       </td>
      </xsl:template>
 <xsl:template match="status">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
       <xsl:template match="surname">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
       <xsl:template match="name">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="chn">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="age">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="gender">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="lastSeen">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="patientID">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
</xsl:stylesheet>

But this is the result:
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body>
Castelano
   &lt;data&gt;
	&lt;product&gt;Hearth Failure Management&lt;/product&gt;
	&lt;error_code&gt;200&lt;/error_code&gt;
	&lt;command&gt;List of Patient&lt;/command&gt;
    
	&lt;rows&gt;
		&lt;row&gt;
			&lt;status&gt;Alert!&lt;/status&gt;
			&lt;surname&gt;Rodriguez&lt;/surname&gt;
			&lt;name&gt;Manuel&lt;/name&gt;
    
			&lt;chn&gt;1234556789&lt;/chn&gt;
			&lt;age&gt;60&lt;/age&gt;
			&lt;gender&gt;F&lt;/gender&gt;
			&lt;lastSeen&gt;lastSeen&lt;/lastSeen&gt;
    
			&lt;patientID&gt;1563&lt;/patientID&gt;
		&lt;/row&gt;
		

	&lt;/rows&gt;
&lt;/data&gt;

</body></html>

 
The table.xsl transformer does not works and also it converts tag in html code .... :(
But if I save the partial result [see the  XML shown before table.xsl code] in a file and I apply the table.xsl styleshett it works correctly. I also test this feature inside a match process of Cocoon's pipeline and it works fine... [
http://idle.lst.tfo.upm.es:8080/cocoon/hfm/prova ]
This is the the code of the pipeline:

 <map:match pattern="result">
      <map:generate type="jx"  src=""/>
                <map:transform type="i18n">
                <map:parameter name="default-catalogue-id" value="messages"  location="translations"/>
            <map:parameter name="locale" value="{../locale}"/>
          </map:transform>
        <map:transform src=""/>   
            <map:transform src=""/>  
                <map:transform src=""/> 
            <map:serialize type="xhtml"/>
   </map:match> 

and if you want to see the results:

http://idle.lst.tfo.upm.es:8080/cocoon/hfm/product?data="">

And this is very strange:

http://idle.lst.tfo.upm.es:8080/cocoon/hfm/prova   is a process that use the partial XML as static file and apply the table.xsl transformer..... this work!!!

Why it does not work in my process.....????


THANKS VERY MUCH


manuel ottaviano
*










Reply via email to