First, Brad, could you please fix your TO: and CC:. I'm on the xalan-j-users 
list, so I'm getting your emails twice.
Thanks.

Now, I want to make sure that you've read the XSL spec (forgive me if I sound 
stern, it's just very important to get
this)

7.6.1 Generating Text with xsl:value-of
"The required select attribute is an expression; this expression is evaluated 
and the resulting object is converted to a
string as if by a call to the string function"

It would also be good to carefully read:

11.3 Using Values of Variables and Parameters with xsl:copy-of

Therefore the template snippet

PageText{<xsl:value-of select="$body"/>}

will show no markup in the output. However, using xsl:copy-of will preserve the 
markup.

But I'm afraid your real problem arises when you call task:addPage($task, 
@ident, $body), where you're expecting that
$body is a string with markup. Read my earlier e-mail remarks on this problem.

Cheers -- Frank.

Brad Cox wrote:

> On Sunday, February 3, 2002, at 09:45 AM, Brad Cox wrote:
>
> > One last glitch and I"m there. All xhtml markup is being
> > stripped from $pageText.
>
> This is driving me crazy. I'm still hung on the same problem.
> Can someone please help? Here's the nub of it:
>
> <xsl:template match="page">
> <xsl:variable name="body">
> #parse("vel/macros.vel")
> #taskOpening("@ident")
> <xsl:apply-templates select="*"/>
> #taskClosing("@ident")
> </xsl:variable>
> PageText{<xsl:value-of select="$body"/>}
> <xsl:value-of select="task:addPage($task, @ident, $body)" />
> </xsl:template>
>
> I've confirmed that the $body variable within the addPage
> routine contains only text minus markup. In particular, for
>
> <task ident="HelloWorld">
>         <page ident="LoremIpsem">
>                 <p>Foo</p>
>         </page>
> </task>
>
> I'm seeing CopyOf{Foo} in the output when I should be seeing
> <p>CopyOf(<p>Foo</p>)</p>. It appears that markup is deleted
> when the results are saved in a variable. If I add a
> <xsl:apply-templates select="*"/> outside of the variable
> assignment in the above, the output contains markup as expected.
>
> Here is the whole stylesheet.
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>         xmlns:task="edu.virtualschool.model.Task"
>         extension-element-prefixes="task"
>         exclude-result-prefixes="java"
>  >
> <xsl:output method="html"/>
> <xsl:param name="task">null</xsl:param>
>
> <xsl:template match="/task">
> #set($totalPages = <xsl:value-of select="count(page)"/>)
> #set($pageTitles = [<xsl:for-each select="page">"<xsl:value-of
> select="@ident"/>",</xsl:for-each>"Submit page"])
> <xsl:apply-templates select="page"/>
> </xsl:template>
>
> <xsl:template match="page">
> <xsl:variable name="body">
> #parse("vel/macros.vel")
> #taskOpening("@ident")
> <xsl:apply-templates select="*"/>
> #taskClosing("@ident")
> </xsl:variable>
> PageText{<xsl:value-of select="$body"/>}
> <xsl:value-of select="task:addPage($task, @ident, $body)" />
> </xsl:template>
>
> <xsl:template
> match="EmailQuestion|EssayQuestion|NameQuestion|UrlQuestion|PhoneQuestion"
>  >
> #<xsl:value-of select="name()"/>("<xsl:value-of
> select="@ident"/>" "<xsl:value-of select="normalize-
> space(text())"/>")
> </xsl:template>
>
> <xsl:template match="MenuQuestion|RadioQuestion|CheckboxQuestion">
> #<xsl:value-of select="name()"/>("<xsl:value-of
> select="@ident"/>" "<xsl:value-of select="normalize-
> space(text())"/>" [<xsl:for-each select="option">"<xsl:value-of
> select="."/>"<xsl:if test="not(position() =
> last())">,</xsl:if></xsl:for-each>])
> </xsl:template>
>
> <xsl:template match="*">
> <p>CopyOf{<xsl:copy-of select="."/>}</p>
> </xsl:template>
>
> </xsl:stylesheet>

Reply via email to