You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Omar Adobati <om...@gmail.com> on 2006/08/31 17:10:03 UTC

Flowscript and Array

Good Morning,

I'm trying to fill an array with push() but cocoon tells me that push
is not a function.
this is a snippet of code:

var a = new Array();
a{"prop1" : value1, "prop2" : value 2}
// I execute some code using the data in a
// that will return back one other value
var vale3 = somefunction(a)
a.push({"param3" : value3})

but doesn't work :(

any mistake? any suggestions?


-- 
Dr. Omar Adobati
omar.adobati@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Omar Adobati <om...@gmail.com>.
I'm not so expert, so... what you suggest to use?
I need to pass via cocoon.sendPage("go-there", myvalues-array-or-hash)...


Omar

On 8/31/06, Tony Collen <tc...@gmail.com> wrote:
> It depends. Do you really want an array or hashes, or just a single
> hash with separate keys?
>
> Tony
>
> On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> > Tony,
> >
> > So, what's the way I should to use?
> >
> > Omar
> >
> > On 8/31/06, Tony Collen <tc...@gmail.com> wrote:
> > > It looks like you are confusing Arrays with Hashes, since you're
> > > creating a new Array but treating it like a hash in your code,
> > > particularly the second line.
> > >
> > > Regards,
> > >
> > > Tony
> > >
> > >
> > > On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> > > > Good Morning,
> > > >
> > > > I'm trying to fill an array with push() but cocoon tells me that push
> > > > is not a function.
> > > > this is a snippet of code:
> > > >
> > > > var a = new Array();
> > > > a{"prop1" : value1, "prop2" : value 2}
> > > > // I execute some code using the data in a
> > > > // that will return back one other value
> > > > var vale3 = somefunction(a)
> > > > a.push({"param3" : value3})
> > > >
> > > > but doesn't work :(
> > > >
> > > > any mistake? any suggestions?
> > > >
> > > >
> > > > --
> > > > Dr. Omar Adobati
> > > > omar.adobati@gmail.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > > For additional commands, e-mail: users-help@cocoon.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Tony Collen
> > > weblog: http://weblog.halogenlabs.com/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> >
> >
> > --
> > Dr. Omar Adobati
> > omar.adobati@gmail.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> --
> Tony Collen
> weblog: http://weblog.halogenlabs.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Dr. Omar Adobati
omar.adobati@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Tony Collen <tc...@gmail.com>.
It depends. Do you really want an array or hashes, or just a single
hash with separate keys?

Tony

On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> Tony,
>
> So, what's the way I should to use?
>
> Omar
>
> On 8/31/06, Tony Collen <tc...@gmail.com> wrote:
> > It looks like you are confusing Arrays with Hashes, since you're
> > creating a new Array but treating it like a hash in your code,
> > particularly the second line.
> >
> > Regards,
> >
> > Tony
> >
> >
> > On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> > > Good Morning,
> > >
> > > I'm trying to fill an array with push() but cocoon tells me that push
> > > is not a function.
> > > this is a snippet of code:
> > >
> > > var a = new Array();
> > > a{"prop1" : value1, "prop2" : value 2}
> > > // I execute some code using the data in a
> > > // that will return back one other value
> > > var vale3 = somefunction(a)
> > > a.push({"param3" : value3})
> > >
> > > but doesn't work :(
> > >
> > > any mistake? any suggestions?
> > >
> > >
> > > --
> > > Dr. Omar Adobati
> > > omar.adobati@gmail.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> >
> >
> > --
> > Tony Collen
> > weblog: http://weblog.halogenlabs.com/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> --
> Dr. Omar Adobati
> omar.adobati@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Tony Collen
weblog: http://weblog.halogenlabs.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Omar Adobati <om...@gmail.com>.
Toby,
  thanks for the samples and for the link!!!

On 8/31/06, Toby <to...@linux.it> wrote:
> Omar Adobati wrote:
> > So, what's the way I should use?
>
> This is an array in JavaScript:
>
>         var a1 = new Array()    // new empty array
>         var a2 = [1,2,3]        // new initialized array
>         assert(a2[0] == 1)      // member access
>         a2[3] = 4               // setting or extending
>         a2.push(5)              // extending, method #2
>         assert(a2 == [1,2,3,4,5])
>
> This is an object, or dictionary, or hash:
>
>         var o1 = new Object()           // new empty object/hash
>         var o2 = { a:'AA', b:'BB' }     // new initialized object
>         assert(o2.a == 'AA')            // two ways of accessing members
>         assert(o2['a'] == 'AA')
>         o2.c = 'CC'                     // same for setting/extending
>         o2['d'] = 'DD'
>
> Please take a look at this: http://javascript-reference.info/
>
>
> Toby
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Dr. Omar Adobati
omar.adobati@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Generator XSD

Posted by rachid harradi <ra...@gmx.net>.
how I can say the generator that it eim XML document provided however on the basis a XSD or a DTD?
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Database Request in XML Document or XML SAX

Posted by rachid harradi <ra...@gmx.net>.
hello 

ich ask Database witch Action. i will the ResultSet in XML Document. this XML Documnet i want to pass at transformer or generator. but i dont know how?
i need your Help!!!!
-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Re: xslt transformer doesn't find the value of attributes

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 9/1/06, Alberto Brosich <br...@units.it> wrote:

> ...xalan -v returns:
> Xalan version 1.10.0
> Xerces version 2.7.0...

Ok, it's an oooooooooold version then, that explains the different behavior.

Thanks for the info!
-Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt transformer doesn't find the value of attributes

Posted by Alberto Brosich <br...@units.it>.
Bertrand Delacretaz wrote:
> On 9/1/06, Alberto Brosich <br...@units.it> wrote:
>
>> ..Here is the mistake...
>
> But you said it worked with xalan at the command-line?
>
> If yes, can you indicate with which version of Xalan it works? Might
> be an "interesting" bug.
Yes, it works.

dpkg returns:

ii  libxerces27    2.7.0-2        validating XML parser library for C++
ii  xalan          1.10-3         XSLT processor

xalan -v returns:  
Xalan version 1.10.0
Xerces version 2.7.0

The system is Debian Etch AMD64 and isn't where is running cocoon (I 
cannot install xalan on this system and I cannot run cocoon on AMD64 
because I need a library (sapjco 2.0) that doesn't exist for 64 bit).

Alberto

>
> -Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Action Database Generator

Posted by rachid harradi <ra...@gmx.net>.
hello,

by the following Action I want to ask database and  i want pass the result at generator. on the again into certain format i want to pass at Transformer:

<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<map:components>
 	<map:actions>
         <map:action name="select" logger="sitemap.action.select" 
         	src="dbmanager.AmeliSelect"/>
      </map:actions>
</map:components>

<map:pipelines >
<!--internal-only="true"-->
  <map:pipeline > 
     <map:match pattern="">
      	<map:act type="select">
      		<map:generate type="file" src="content/ObjectionHTML.xml"/>
      		<map:transform src="stylesheets/objection04.xslt"/>
      		<map:serialize type="html" />
      	</map:act>
     </map:match>
   </map:pipeline>
   
   <!--map:pipeline> 
  <map:match pattern=""> 
    <map:generate type="request" src="cocoon:/select/"/> 
    <map:serialize type="xml" />
  </map:match> 
</map:pipeline--> 
   
</map:pipelines>

</map:sitemap>



package dbmanager;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.avalon.excalibur.datasource.DataSourceComponent;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.acting.AbstractAction;
import org.apache.cocoon.acting.AbstractDatabaseAction;
import org.apache.cocoon.acting.DatabaseSelectAction;

import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.commons.lang.StringUtils;
import org.xml.sax.InputSource;

import wohland.de.Framework.JDBC.Default.Persistable;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.BooleanMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.ByteMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.DateMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.DefaultPersistable;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.DoubleMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.FloatMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.IntMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.LongMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.Mapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.NumericMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.ShortMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.StringMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.TimeMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.TimestampMapper;
import wohland.de.Framework.JDBC.Default.DefaultSqlOperation.TinyBooleanMapper;

import cuba.ComponentException;

public class AmeliSelect extends DatabaseSelectAction  implements ThreadSafe,
		Composable, Disposable {

	// private static final Map selectStatements = new HashMap();
	// private DBManager dbm = null;
	// private ServiceManager manager = null;
	// private InputSource inputSource = null;
	// DataSourceComponent datasource = null;
	  private  ResultSet resultSet ;
	   private DBManager dbm; 
//	   private ServiceManager manager;
	protected ComponentSelector dbselector;

	protected ComponentManager manager;

	private static HashMap mappers = null;

	// public void service(ServiceManager serviceManager) throws
	// ServiceException {
	// System.out.println("[User.java | service] beginn");
	// this.manager = serviceManager;
	//
	// }
	public void compose(ComponentManager  manager) throws org.apache.avalon.framework.component.ComponentException  {
		// TODO Auto-generated method stub
		this.dbselector = (ComponentSelector) manager
				.lookup(DataSourceComponent.ROLE + "Selector");

	}

	//	public void compose()
	//			throws org.apache.avalon.framework.component.ComponentException {
	//		this.dbselector = (ComponentSelector) manager
	//				.lookup(DataSourceComponent.ROLE + "Selector");
	//	}

	protected final DataSourceComponent getDataSource(String pool)
			throws org.apache.avalon.framework.component.ComponentException {
		return (DataSourceComponent) this.dbselector.select(pool);
	}

	public Map act(Redirector redirector, SourceResolver resolver,
			Map objectModel, String source, Parameters param) throws Exception {
		
		String query = " select * FROM Field_Descriptions";

		// AmeliSelect.selectStatements.put(conf, query);

		Request request = ObjectModelHelper.getRequest(objectModel);
		Map map = new HashMap();
//		DataSourceComponent dataSource = getDataSource("ameli_para_dev_datasource");
//		Connection connection = null;
		
		try {
//			connection = dataSource.getConnection();
//			Statement statement = connection.createStatement();
//			String cmd = query;
//
//			ResultSet rs = statement.executeQuery(cmd);
			System.out.println("[User.java | User] pre"); 
	         this.dbm = (DBManager)this.manager.lookup(DBManager.ROLE);
	         
	            System.out.println("[User.java | User] middle"); 
//	            resultSet = dbm.sqlSelect("select *  from Field_Descriptions");
	            List list = dbm. sqlSelect2List("select *  from Field_Descriptions");
	            System.out.println("[User.java | User] after"); 
//			map = constructResultFromResultSet( resultSet);
	            
			Iterator iterator = list.iterator();
			while (iterator.hasNext()) {
				// Get key
				int i=0;
				request.setAttribute(new Integer(i++).toString(), list.get(i));
			}
			
			return EMPTY_MAP;
		} catch (Exception e) {
			// TODO: handle exception
					getLogger().error("Query failed: ", e);
		} 
//		finally {
//			try {
//				if (connection != null) {
//					connection.close();
//				}
//			} catch (SQLException sqe) {
//				// TODO: handle exception
//				getLogger().error("Error closing the datasource", sqe);
//			}
//
//		}
		return null;

		//		return (map);
	}

	public void dispose() {
		this.manager.release(dbselector);
	}

	protected String getSelectQuery(Configuration conf)
			throws ConfigurationException {
		String query = null;

		// synchronized (AmeliSelect.selectStatements) {
		// query = (String)AmeliSelect.selectStatements.get(conf);

		// if (query == null) {
		// Configuration table = conf.getChild("table");
		// Configuration[] keys = table.getChild("keys").getChildren("key");
		// Configuration[] values =
		// table.getChild("values").getChildren("value");
		//
		// StringBuffer queryBuffer = new StringBuffer("SELECT ");
		// queryBuffer.append(buildList(keys, 0));
		// queryBuffer.append(buildList(values, keys.length));
		// queryBuffer.append(" FROM ");
		// queryBuffer.append(table.getAttribute("name"));
		//
		// queryBuffer.append(" WHERE ");
		// queryBuffer.append(buildList(keys, " AND "));
		// query = queryBuffer.toString();
		query = " select ID_Entity AS ID_Entity, ID_Field AS ID_Field, DataType AS DataType, Caption AS Caption , Mask AS Mask, DefaultValue AS DefaultValue, Mandatory AS Mandatory, ValueCheck AS ValueCheck , Enabled AS Enabled, Visible AS Visible, Range_Lower AS Range_Lower, Range_Upper AS Range_Upper , ValueCheck AS ValueCheck, Size AS Size , Icon AS Icon, Language AS Language FROM Field_Descriptions";

		// AmeliSelect.selectStatements.put(conf, query);
		// }
		// }
		// // return query;
		return null;
	}

	protected HashMap constructResultFromResultSet(ResultSet rs)
			throws SQLException {
		ResultSetMetaData md = rs.getMetaData();
		int columnCount = md.getColumnCount();
		List results = new ArrayList();
		Map resultsmap = new Hashtable();
		// save information in first row
		HashMap propInfo = new HashMap();
		HashMap props = new HashMap();
		for (int i = 0; i < columnCount; i++) {
			String columnName = md.getColumnName(i + 1);
			propInfo.put("column" + i, columnName);
		}
		Persistable pInfo = getNewPersistable();
		pInfo.setProperties(propInfo);
		results.add(pInfo);
		// get data from rs start from pos 1
		while ((rs != null) && (rs.next())) {

			for (int i = 0; i < columnCount; i++) {
				String columnName = md.getColumnName(i + 1);
				int type = md.getColumnType(i + 1);
				Object o = getValue(rs, type, i + 1);
				//				if (debugSQL())
				//					System.err.println(columnName + " = " + o);
				if (o != null) {
					props.put(columnName, o);
				} else {
					// props.put(columnName, "<null>");
				}
			}
			Persistable p = getNewPersistable();
			// if (debugSQL())
			// System.err.println("Setting properties with: " + props);
			//			logger.debug("Setting properties with: " + props);
			p.setProperties(props);
			results.add(p);
		}
		//		return results;
		return propInfo;
	}

	protected Persistable getNewPersistable() {
		return new DefaultPersistable();
	}

	protected Object getValue(ResultSet rs, int type, int index) {
		// if (debugSQL())
		// System.err.println("COLUMN TYPE = " + type);
		// logger.debug("COLUMN TYPE = " + type);

		try {

			// handle the mysql TINYINT to Boolean Type
			if ((rs.toString().indexOf("mysql") > 0) && (type == Types.TINYINT)) {
				// type for TinyBoolean in mysql !! not standard
				type = -1111;
			}

			if ((rs.toString().indexOf("microsoft") > 0)
					&& (type == Types.FLOAT)) {
				// type for Float in sqlserver !! not standard
				type = Types.DOUBLE;
				//				System.out.println("type " + type);		  	  	
			}

			Mapper m = getMapper(new Integer(type));
			if (m != null) {
				return m.getValue(rs, index);
			}
		} catch (Exception x) {
			// NULL values in the database cause most of the Mapper classes to
			// fail
			// a NULL value will result in the absence of this property from the
			// result.
			// if (debugSQL())
			// System.err.println(
			// "Warning: Unknown column type or NULL value for column " +
			// index);
			//			logger.fatal(
			//					"Warning: Unknown column type or NULL value for column "
			//							+ index, x);
		}
		return null;
	}

	protected Mapper getMapper(Object key) {
		if (mappers == null) {
			mappers = new HashMap();
			registerMapper(Byte.class, Types.TINYINT, new ByteMapper());
			DateMapper dm = new DateMapper();
			registerMapper(java.util.Date.class, Types.DATE, dm);
			// always convert sql Dates to util Dates from ResultSets
			registerMapper(java.sql.Date.class, 0, dm);
			registerMapper(Double.class, Types.DOUBLE, new DoubleMapper());
			registerMapper(Float.class, Types.FLOAT, new FloatMapper());
			registerMapper(Integer.class, Types.INTEGER, new IntMapper());
			registerMapper(java.math.BigDecimal.class, Types.NUMERIC,
					new NumericMapper());
			registerMapper(Long.class, Types.BIGINT, new LongMapper());
			registerMapper(Short.class, Types.SMALLINT, new ShortMapper());
			StringMapper strm = new StringMapper();
			registerMapper(String.class, Types.VARCHAR, strm);
			// mySQL return VARCHAR as CHAR
			registerMapper(String.class, Types.CHAR, strm);
			registerMapper(null, Types.LONGVARCHAR, strm);
			registerMapper(Time.class, Types.TIME, new TimeMapper());
			registerMapper(Timestamp.class, Types.TIMESTAMP,
					new TimestampMapper());
			// assume blob as string
			// mySQL return blob as LONGVARBINARY
			registerMapper(String.class, Types.BLOB, strm);
			registerMapper(String.class, Types.LONGVARBINARY, strm);
			// mySQL return tinyint as Boolean
			registerMapper(Boolean.class, -1111, new TinyBooleanMapper());
			// SQLServer return value
			registerMapper(Boolean.class, Types.BIT, new BooleanMapper());
		}
		return (Mapper) mappers.get(key);
	}

	public static void registerMapper(Class valueType, int sqlType,
			Mapper aMapper) {
		if (valueType != null)
			mappers.put(valueType, aMapper);
		if (sqlType != 0)
			mappers.put(new Integer(sqlType), aMapper);
	}
}


which generator i must to use ? which Object must i pass from Action to ggenerator?

-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Re: xslt transformer doesn't find the value of attributes

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 9/1/06, Alberto Brosich <br...@units.it> wrote:

> ..Here is the mistake...

But you said it worked with xalan at the command-line?

If yes, can you indicate with which version of Xalan it works? Might
be an "interesting" bug.

-Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt transformer doesn't find the value of attributes

Posted by Alberto Brosich <br...@units.it>.
Bertrand Delacretaz wrote:
> On 9/1/06, Alberto Brosich <br...@units.it> wrote:
>
>> <xsl:template match="rfc:include">
>>     <xsl:element name="p"><xsl:value-of select="@name"/></xsl:element>
>
>> ...xsl:value-of
>> retrieves no value and so on in the other templates.
>
> Did you try with @rfc:name, in case the attribute has a namespace as 
> well?
No, of course! :-)

Here is the mistake.

Thank you very much

Alberto
>
> -Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt transformer doesn't find the value of attributes

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 9/1/06, Alberto Brosich <br...@units.it> wrote:

> <xsl:template match="rfc:include">
>     <xsl:element name="p"><xsl:value-of select="@name"/></xsl:element>

> ...xsl:value-of
> retrieves no value and so on in the other templates.

Did you try with @rfc:name, in case the attribute has a namespace as well?

-Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


xslt transformer doesn't find the value of attributes

Posted by Alberto Brosich <br...@units.it>.
I have a strange problem.

I have a simple stylesheet where I match nodes and use their attribute. 
Follow a snip:

...
<xsl:template match="rfc:include">
    <xsl:element name="p"><xsl:value-of select="@name"/></xsl:element>
    <xsl:element name="table">
        <xsl:apply-templates />
    </xsl:element>
</xsl:template>
...

rfc:include is matched, element "<p>" is written but xsl:value-of 
retrieves no value and so on in the other templates.
I tried also saxon but the result is the same.

Using the stylesheet and the xml file saved from pipeline with command 
line version of xalan works all fine!
So, where's the mistake?

Thanks in advance

Alberto


Cocoon 2.1.9
Sun JDK 1.5.0_4
Debian sarge

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Toby <to...@linux.it>.
Omar Adobati wrote:
> So, what's the way I should use?

This is an array in JavaScript:

	var a1 = new Array()	// new empty array
	var a2 = [1,2,3]	// new initialized array
	assert(a2[0] == 1)	// member access
	a2[3] = 4		// setting or extending
	a2.push(5)		// extending, method #2
	assert(a2 == [1,2,3,4,5])

This is an object, or dictionary, or hash:

	var o1 = new Object()		// new empty object/hash
	var o2 = { a:'AA', b:'BB' }	// new initialized object
	assert(o2.a == 'AA')		// two ways of accessing members
	assert(o2['a'] == 'AA')
	o2.c = 'CC'			// same for setting/extending
	o2['d'] = 'DD'

Please take a look at this: http://javascript-reference.info/


Toby

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Omar Adobati <om...@gmail.com>.
Tony,

So, what's the way I should to use?

Omar

On 8/31/06, Tony Collen <tc...@gmail.com> wrote:
> It looks like you are confusing Arrays with Hashes, since you're
> creating a new Array but treating it like a hash in your code,
> particularly the second line.
>
> Regards,
>
> Tony
>
>
> On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> > Good Morning,
> >
> > I'm trying to fill an array with push() but cocoon tells me that push
> > is not a function.
> > this is a snippet of code:
> >
> > var a = new Array();
> > a{"prop1" : value1, "prop2" : value 2}
> > // I execute some code using the data in a
> > // that will return back one other value
> > var vale3 = somefunction(a)
> > a.push({"param3" : value3})
> >
> > but doesn't work :(
> >
> > any mistake? any suggestions?
> >
> >
> > --
> > Dr. Omar Adobati
> > omar.adobati@gmail.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> --
> Tony Collen
> weblog: http://weblog.halogenlabs.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Dr. Omar Adobati
omar.adobati@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Flowscript and Array

Posted by Tony Collen <tc...@gmail.com>.
It looks like you are confusing Arrays with Hashes, since you're
creating a new Array but treating it like a hash in your code,
particularly the second line.

Regards,

Tony


On 8/31/06, Omar Adobati <om...@gmail.com> wrote:
> Good Morning,
>
> I'm trying to fill an array with push() but cocoon tells me that push
> is not a function.
> this is a snippet of code:
>
> var a = new Array();
> a{"prop1" : value1, "prop2" : value 2}
> // I execute some code using the data in a
> // that will return back one other value
> var vale3 = somefunction(a)
> a.push({"param3" : value3})
>
> but doesn't work :(
>
> any mistake? any suggestions?
>
>
> --
> Dr. Omar Adobati
> omar.adobati@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Tony Collen
weblog: http://weblog.halogenlabs.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org