You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marco Spinetti <m....@pisa.iol.it> on 2000/10/19 09:08:41 UTC

STRING AND XSP

I have the following problem: shall I take a text from a Tag of a Xml
file (as I do if the text is on several lines)? ) I manipulate it and
then I want to print it inside a Tag of a Xml file which I am building
(then apply another Xsl to this).
To take the text I use:

<xsp:logic>
String Body = "<xsl:value-of select="./Generale/Descrizione"/>";
</xsp:logic>

When I want to print the String Body in my Tag I use:

<CORPO>
<xsp:expr>Body</xsp:expr>
</CORPO>

The problem is that the previous instruction prints Body and not the
text in the string Body. How can I to print the text in the string Body?

Help me
Marco
m.spinetti@pisa.iol.it



Re: STRING AND XSP

Posted by marco <m....@pisa.iol.it>.
Michael Bierenfeld wrote:

> > Marco Spinetti wrote:
> >
> > I have the following problem: shall I take a
> > text from a Tag of a Xml
> > file (as I do if the text is on several lines)?
> > ) I manipulate it and
> > then I want to print it inside a Tag of a Xml
> > file which I am building
> > (then apply another Xsl to this).
> > To take the text I use:
> >
> > <xsp:logic>
> > String Body = "<xsl:value-of
> > select="./Generale/Descrizione"/>";
> > </xsp:logic>
> >
> > When I want to print the String Body in my Tag I
> > use:
> >
> > <CORPO>
> > <xsp:expr>Body</xsp:expr>
> > </CORPO>
> >
> > The problem is that the previous instruction
> > prints Body and not the
> > text in the string Body. How can I to print the
> > text in the string Body?
> >
> > Help me
> > Marco
> > m.spinetti@pisa.iol.it
>
> Hi,
>
> its hard to tell whats going on. Could you be a
> little bit more specific.
>
> Regards
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Hi,
 I will try to be more precise: as I do to print the value of one String
whose has value been set up with Xsp? The Xsl code I use is the
following:
****************************************************************************************

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<xsl:param name='sceltau'/>
<xsl:param name='segnou'/>
<xsl:template match="Oroscopo">
<xsl:processing-instruction
name="cocoon-process">type="xslt"</xsl:processing-instruction>
<xsl:processing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>
<!-- <xsl:processing-instruction
name="cocoon-process">type="xslt"</xsl:processing-instruction> -->
<xsl:processing-instruction
name="xml-stylesheet">href="stampa16-wml.xsl"
type="text/xsl"</xsl:processing-instruction>
<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:request="http://www.apache.org/1999/XSP/Request">
<OROSCOPO>
<xsl:for-each select="child::Segno[Zodiaco/text()=$segnou]">
<SEGNO immagine="{./Image/@immagine}">
<xsl:value-of select="$segnou"/>
</SEGNO>
</xsl:for-each>
<xsl:for-each select="child::Segno[Zodiaco/text()=$segnou]">
<PRESO>
Siamo entrati:ok
</PRESO>
<xsl:choose>
<xsl:when test="$sceltau='generale'">
<xsl:variable name="body">"<xsl:value-of
select="./Generale/Descrizione"/>"</xsl:variable>
<xsp:logic>
String Body = String.valueOf(<xsl:copy-of select="$body"/>);
</xsp:logic>
</xsl:when>
<xsl:when test="$sceltau='amore'">
<xsp:logic>
String Body = "<xsl:value-of
select="Aspetto[@code='Amore']/Descrizioneaspetto"/>";
</xsp:logic>
</xsl:when>
<xsl:when test="$sceltau='denaro'">
<xsp:logic>
String Body = "<xsl:value-of select="Aspetto[@code='Lavoro e
Denaro']/Descrizioneaspetto"/>";
</xsp:logic>
</xsl:when>
<xsl:when test="$sceltau='fortuna'">
<xsp:logic>
String Body = "<xsl:value-of
select="Aspetto[@code='Fortuna']/Descrizioneaspetto"/>";
</xsp:logic>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- <xsp:logic>
int  tokens = 40;
String ris;
String output;
String segno = request.getParameter("segnou");
String scelta = request.getParameter("sceltau");
String sstep = null;
int step;
sstep = request.getParameter("step");
if (sstep == null) step = 0;
else step = new Integer(sstep).intValue();
</xsp:logic> -->
<CORPO>
<xsp:expr>Body</xsp:expr>
</CORPO>
</OROSCOPO>
</xsp:page>
</xsl:template>
</xsl:stylesheet>
*****************************************************************************************

The problem is that if I try with another Xsl to print the value of the
String Body (with the tag  <xsl:value-of select="child::CORPO"/> ) I
obtain
Body
and not the text inserted in the string.
Why?
What's my error?
Can it depend on the fact that the String is long? Or he can depend on
the fact that I execute the before Xslt transformation and then Xsp  ?
(I am forced to do that)
Help me, I don't know what to do.
Marco
m.spinetti@pisa.iol.it



Re: STRING AND XSP

Posted by Michael Bierenfeld <mi...@atmiralis.de>.
> Marco Spinetti wrote:
> 
> I have the following problem: shall I take a
> text from a Tag of a Xml
> file (as I do if the text is on several lines)?
> ) I manipulate it and
> then I want to print it inside a Tag of a Xml
> file which I am building
> (then apply another Xsl to this).
> To take the text I use:
> 
> <xsp:logic>
> String Body = "<xsl:value-of
> select="./Generale/Descrizione"/>";
> </xsp:logic>
> 
> When I want to print the String Body in my Tag I
> use:
> 
> <CORPO>
> <xsp:expr>Body</xsp:expr>
> </CORPO>
> 
> The problem is that the previous instruction
> prints Body and not the
> text in the string Body. How can I to print the
> text in the string Body?
> 
> Help me
> Marco
> m.spinetti@pisa.iol.it

Hi,

its hard to tell whats going on. Could you be a
little bit more specific.

Regards

Michael