struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Van Horn <matthew_van_h...@yahoo.com>
Subject RE: Struts from XSLT
Date Wed, 28 Jul 2004 22:00:09 GMT
Are you sure you are in the right context when you call 'name()' ?

Here is some working XML / XSLT - you can try it at:
http://www.cherrypy.org/demo/xmlXslOnline
XML Doc:
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo>
    <bar>baz</bar>
</foo>


XSLT Doc:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:bean="http://struts-namespace-here">

<xsl:template match="/">
	<html xmlns:bean="http://struts-namespace-here">
	<xsl:apply-templates/>
	</html>
</xsl:template>

<xsl:template match="foo">
	<bean:message>
		<xsl:attribute name="key"><xsl:value-of
select="name()"/></xsl:attribute>
	</bean:message>
</xsl:template>

</xsl:stylesheet>

Html result:
<html  xmlns:bean="http://struts-namespace-here">
    <bean:message  key="foo"/>
</html> 



On Wed, 2004-07-28 at 19:01, Johan Wasserman - BCX - Infrastructure
Services wrote:
> Tried that approach unsuccessfully (output is "null").  Is your
> suggestion factual (do you have it working that way)?  Then maybe I'm
> looking at a xalan version issue or something (I doubt, it's quite
> current).
> 
> Aolso tried:
> <xsl:template match="foo"> 
> 	&lt;bean:message key="<xsl:value-of select="name()"/>"/&gt;
> </xsl:template>
> 
> But that renders <bean:message key="bar"/> to the HTML output and struts
> don't kick in.
> 
> -----Original Message-----
> From: Matthew Van Horn [mailto:matthew@ashleyassociates.co.jp] 
> Sent: Wednesday, July 28, 2004 11:48 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Struts from XSLT
> 
> 
> Assuming an element:
> <foo/>
> 
> If you are doing a XSLT transform, it would be:
> 
> <xsl:template match="foo">
> 	<bean:message>
> 		<xsl:attribute name="key"><xsl:value-of
> select="name()"/></xsl:attribute>
> 	<bean:message>
> </xsl:template>
> 
> This will result in:
> 
> <bean:message key="foo"/>
> 
> -Matt
> 
> > -----Original Message-----
> > From: Johan Wasserman - BCX - Infrastructure Services
> > [mailto:Johan.Wasserman@bcx.co.za] 
> > Sent: Wednesday, July 28, 2004 6:25 PM
> > To: user@struts.apache.org
> > Subject: Struts from XSLT
> > 
> > 
> > How do I assign output from xsl to bean:message or fmt:message.
> >  
> > For example <bean:message key="<xsl:value-of select"name()"/>"/>
> >  
> > I have tried using <fmt:message><xsl:value-of
> > select"name()"/></fmt:message>
> >  
> > It doesn't work.
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
-- 
Matthew Van Horn <matthew_van_horn@yahoo.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message