You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Ki Choi <kc...@acm.org> on 2000/03/29 09:37:07 UTC
Translate to JavaScript by XSL
Does anyone do anywork on translating JavaScript by using XSL, I tried and
blocked by don't know how to translate the and operator (i.e. &&) in
JavaScript,
I did use && on the XSL but then it gives error message complainting
for require an entity name.
thanks,
Ki
email: kchoi@acm.org
Re: How to access xml tag attribute with XSL ?
Posted by John Carroll <jc...@micromuse.com>.
Benoit Fouche wrote:
> Xsuse me John, but I think you do not understand my query...
> I'd like to access the attribut IN the XML DOCUMENT, and set it with the XSL
> stylesheet.
> (like the <xsl:value-of select='card'> but not the content of the tag
> <card>, just the attribut "id" that is in <card id='menuCard'>...
> So how can I recover this "id" attribut in the XML source ?
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
<xsl:value-of select="@title"/> for value of the title attribute
or
<xsl:value-of select="@id"/> for value of the id attribute
cheers,
John.
Re: How to access xml tag attribute with XSL ?
Posted by Benoit Fouche <b....@cross-systems.com>.
Xsuse me John, but I think you do not understand my query...
I'd like to access the attribut IN the XML DOCUMENT, and set it with the XSL
stylesheet.
(like the <xsl:value-of select='card'> but not the content of the tag
<card>, just the attribut "id" that is in <card id='menuCard'>...
So how can I recover this "id" attribut in the XML source ?
Re: How to access xml tag attribute with XSL ?
Posted by John Carroll <jc...@micromuse.com>.
Benoit Fouche wrote:
> Hi,
> I'm novice with XSL, and I'd like to know if it's posible to access to an
> XML tag attribute using an XSL stylesheet associated with the XML doc ?
>
> example:
> xml doc:
> <card id='menuCard' title='menu1'>
> <p align='left'>
> Hello guys !
> </p>
> </card>
>
> So, I would like to access to the "id" and "title" attributes of the tag
> <card>...
>
> I've writing this for the XSL stylesheet:
> <?xml version="1.0" encoding="ISO8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
>
> <xsl:template match="/">
> <HTML>
> <BODY>
> <xsl:for-each select="wml/card">
> ...here i want to write the title of card...
>
> <p align="center">
> <xsl:apply-templates/>
> </p>
> </xsl:for-each>
> </BODY>
> </HTML>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Thank for helping me !
> Ben.
> bfouche@caramail.com
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
HI,
use
> <?xml version="1.0" encoding="ISO8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
>
> <xsl:template match="/">
> <HTML>
> <BODY>
> <xsl:for-each select="wml/card">
> ...here i want to write the title of card...
<xsl:value-of select="@title"/>
>
> <p align="center">
> <xsl:apply-templates/>
> </p>
> </xsl:for-each>
> </BODY>
> </HTML>
> </xsl:template>
cheers,
John.
How to access xml tag attribute with XSL ?
Posted by Benoit Fouche <b....@cross-systems.com>.
Hi,
I'm novice with XSL, and I'd like to know if it's posible to access to an
XML tag attribute using an XSL stylesheet associated with the XML doc ?
example:
xml doc:
<card id='menuCard' title='menu1'>
<p align='left'>
Hello guys !
</p>
</card>
So, I would like to access to the "id" and "title" attributes of the tag
<card>...
I've writing this for the XSL stylesheet:
<?xml version="1.0" encoding="ISO8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:for-each select="wml/card">
...here i want to write the title of card...
<p align="center">
<xsl:apply-templates/>
</p>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Thank for helping me !
Ben.
bfouche@caramail.com
Re: Translate to JavaScript by XSL
Posted by Stefano Mazzocchi <st...@apache.org>.
Brian Silberbauer wrote:
>
> I use the following:
>
> <xsl:text disable-output-escaping="yes">&</xsl:text>
>
> It works, but there must be a more elegant way!
No, it doesn't: in the code you want the char '&' not the chars '&'
which is what you're doing.
'&&'
can be escaped as
&&
or
<![CDATA[&&]]>
BTW, I even if CDATA sections look _really_ ugly, I suggest to use them
around your code such as
<code><![CDATA[
if ((a < 0) && (b > 10)) {
do.something();
}
]]></code>
which is, to me, the more understandable way to mix code and XML (which
is almost never a pretty thing for XML design choices)
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: Translate to JavaScript by XSL
Posted by Brian Silberbauer <br...@magmatec.co.za>.
I use the following:
<xsl:text disable-output-escaping="yes">&</xsl:text>
It works, but there must be a more elegant way!
brian
Linda Derezinski wrote:
> Try
>
> &&
>
> I always forget the ;
> -Linda Derezinski
>
> -----Original Message-----
> From: Ki Choi [mailto:kchoi@acm.org]
> Sent: Wednesday, March 29, 2000 2:37 AM
> To: general@xml.apache.org
> Subject: Translate to JavaScript by XSL
>
> Does anyone do anywork on translating JavaScript by using XSL, I tried and
> blocked by don't know how to translate the and operator (i.e. &&) in
> JavaScript,
> I did use && on the XSL but then it gives error message complainting
> for require an entity name.
>
> thanks,
> Ki
> email: kchoi@acm.org
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
RE: Translate to JavaScript by XSL
Posted by Linda Derezinski <li...@sclrules.com>.
Try
&&
I always forget the ;
-Linda Derezinski
-----Original Message-----
From: Ki Choi [mailto:kchoi@acm.org]
Sent: Wednesday, March 29, 2000 2:37 AM
To: general@xml.apache.org
Subject: Translate to JavaScript by XSL
Does anyone do anywork on translating JavaScript by using XSL, I tried and
blocked by don't know how to translate the and operator (i.e. &&) in
JavaScript,
I did use && on the XSL but then it gives error message complainting
for require an entity name.
thanks,
Ki
email: kchoi@acm.org
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org