You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Joseph Kesselman <ke...@us.ibm.com> on 2003/04/03 23:44:29 UTC

Re: Unable to generate JSP output with Xalan -- CORRECTION

SORRY; I completely misread the question! (I should learn not to fire from 
the hip when short on sleep.)


The problem you're having is that attribute contents are expected to be 
text, not elements. XSLT won't let you insert the results of xsl:element 
(or even a literal result element) inside an xsl:attribute. You have to 
hand-construct that syntax as text.

Try:

   <xsl:attribute name="value">
      <xsl:text>&lt;getLocalizedResource name="resName":gt;</xsl:text>
    </xsl:attribute>




______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. 
"may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody 
gets hurt.")

Re: Unable to generate JSP output with Xalan -- CORRECTION

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>Is there any particular reason why we are not allowed to use elements as
>content for HTML attributes ?

That's not a concept defined in either HTML or XML. Hence, it's not a 
concept architected into XSLT.

You could try taking this up with the W3C's XSLT Working Group, but I 
think they're going to tell you that the XML Infoset says the content of 
an attribute is Text and therefore it's up to you to generate it as Text.

>What happens if the name of the localized
>resource itself (resName) is a variable coming from the XML document ?

Exit the xsl:text after the quote, call an xsl:value to retrieve the 
variable's contents as a string, start a new xsl:text to close the quotes 
and finish the element.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. 
"may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody 
gets hurt.")

Re: Unable to generate JSP output with Xalan -- CORRECTION

Posted by Liviu Casapu <li...@savvion.com>.

Is there any particular reason why we are not allowed to use elements as
content for HTML attributes ? I perfectly understand this limitation if
XML is chosen as output, but why impose it for HTML ?
One more twist to the problem: What happens if the name of the localized
resource itself (resName) is a variable coming from the XML document ? I'm
afraid <xml:text> will not be able to help us anymore ...

Regards,
Liviu 


> SORRY; I completely misread the question! (I should learn not to fire from 
> the hip when short on sleep.)
> 
> 
> The problem you're having is that attribute contents are expected to be 
> text, not elements. XSLT won't let you insert the results of xsl:element 
> (or even a literal result element) inside an xsl:attribute. You have to 
> hand-construct that syntax as text.
> 
> Try:
> 
>    <xsl:attribute name="value">
>       <xsl:text>&lt;getLocalizedResource name="resName":gt;</xsl:text>
>     </xsl:attribute>
> 
> 
> 
> 
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. 
> "may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody 
> gets hurt.")
>