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 Bruno Sanz Marino <br...@inicia.es> on 2003/05/24 03:37:33 UTC
STX???
Hi
This message is for the people of the Xalan Team
Is there any plan to support Streaming Transformations for XML (STX) in
a nearly future???
I´ve just discovered this "tech" and its looks so exiting for the "post-DOM"
age.
Regards
Bruno Sanz
------------------------------
Tiscali ADSL Libre
http://adsl.tiscali.es/index.php3?produc=libre&did=&despl=&did=adl-7380017
¡¡¡VELOCIDAD 24h. DESDE SÓLO 16,95 /mes + TIEMPO DE CONEXIÓN!!!
Con las mismas prestaciones que una línea ADSL estándar
------------------------------
Re: STX???
Posted by sc...@us.ibm.com.
Well, I think we should have an informed discussion about it. I don't
currently know a lot about this particular proposal. I tend to be wary of
this kind of thing. I notice that Mike Kay's name is on it, so I suppose
that lends it some credibility.
-scott
"Bruno Sanz Marino" <br...@inicia.es> wrote on 05/23/2003 09:37:33 PM:
> Hi
>
> This message is for the people of the Xalan Team
>
> Is there any plan to support Streaming Transformations for XML (STX) in
> a nearly future???
>
> I´ve just discovered this "tech" and its looks so exiting for the
"post-DOM"
> age.
>
> Regards
>
> Bruno Sanz
>
> ------------------------------
> Tiscali ADSL Libre
>
http://adsl.tiscali.es/index.php3?produc=libre&did=&despl=&did=adl-7380017
>
> ¡¡¡VELOCIDAD 24h. DESDE SÓLO 16,95 €/mes + TIEMPO DE CONEXIÓN!!!
> Con las mismas prestaciones que una línea ADSL estándar
> ------------------------------
>
>
>
Calling template using a mode
Posted by Witold Iwaniec <wi...@novalistech.com>.
Hi
I must be missing something simple...
I would like dynamically call templates using the value of a node attribute.
The
XML element has an attribute "type" and I would like to apply a template in
different mode depending on the value of "type".
If I first get the value of the attribute, I can apply the template in a
specific
mode:
<xsl:choose>
<xsl:when test="@type = 'vdtPTD'">
<xsl:apply-templates select="." mode="vdtPTD" />
</xsl:when>
...
</xsl:choose>
but it requires number of <xsl:when> calls.
I thought the following call should work:
<xsl:apply-templates select="." mode="@type" />
but it does not. In the result I get the values of all elements. Am I
missing something simple or can it not be done?
I have tried few options including variables like:
<xsl:variable name="one_panel" select="." />
Panel: <xsl:value-of select="$one_panel/@type" />
<xsl:apply-templates select="." mode="$one_panel/@type" />
The type of the panel is printed correctly using
<xsl:value-of select="$one_panel/@type" />
but the template in mode="$one_panel/@type" is not applied...
The sample XML and stylesheet are below. The calls are in the PANEL
template.
I am using Xalan that comes with J2EE 1.3.1
Thanks
Witold
<?xml version="1.0" encoding="UTF-8"?>
<VIEWER name="PRPV" version="1.1">
<CAPTION><![CDATA[Property]]></CAPTION>
<PANEL name="Key Sample" type="vdtPTD">
<ISKEYPANEL/>
<CAPTION><![CDATA[KEY]]></CAPTION>
<SIZE>15</SIZE>
</PANEL>
<PANEL name="NAME_SAMPLE" type="vdtPTS">
<CAPTION><![CDATA[Name]]></CAPTION>
<SIZE>100</SIZE>
</PANEL>
<PANEL name="RS_SAMPLE" type="vdtPTRS">
<CAPTION><![CDATA[RS]]></CAPTION>
<SIZE>20</SIZE>
</PANEL>
<PANEL name="LAND_SAMPLE" type="vdtPTD">
<CAPTION><![CDATA[Land]]></CAPTION>
<SIZE>145</SIZE>
</PANEL>
</VIEWER>
and the stylesheet:
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" media-type="text/html" encoding="ISO-8859-1" />
<xsl:template match="VIEWER">
<html>
<head>
<title><xsl:value-of select="concat(CAPTION, ' Viewer')" /></title>
</head>
<body>
<br />
<xsl:apply-templates select="PANEL" />
<br />
</body>
</html>
</xsl:template>
<xsl:template match="PANEL">
<xsl:choose>
<xsl:when test="@type = 'vdtPTD'">
<xsl:apply-templates select="." mode="vdtPTD" />
</xsl:when>
<xsl:when test="@type = 'vdtPTRS'">
<xsl:apply-templates select="." mode="vdtPTRS" />
</xsl:when>
<xsl:when test="@type = 'vdtPTS'">
<xsl:apply-templates select="." mode="vdtPTS" />
</xsl:when>
</xsl:choose>
<!-- Does not work. Returns values of all elements
<xsl:apply-templates select="." mode="@type" />
-->
</xsl:template>
<xsl:template match="PANEL" mode="vdtPTD">
PTD. Name: <xsl:value-of select="@name" />
<xsl:if test="ISKEYPANEL"><font color="ff0000"><b> PTD</b></font>
</xsl:if>
<br />
</xsl:template>
<xsl:template match="PANEL" mode="vdtPTRS">
PTRS. Name: <xsl:value-of select="@name" />
<br />
</xsl:template>
<xsl:template match="PANEL" mode="vdtPTS">
PTS. Name: <xsl:value-of select="@name" />
<br />
</xsl:template>
</xsl:stylesheet>