K
Kniffel
Hi everyone
I do a xsl-transformation. And I try to get a Attribute, but I cannot
get it. My XML/XSL experience is not very good at the moment.
I have something like this:
TEST.xml
--------------
<?xml version="1.0" encoding="utf-8"?>
<Main>
<DisplayTime Aktiviert="True" />
<PrintTime Aktiviert="True" />
</Main>
TEST.xsl
-------------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xslutput method="html" version="1.0" encoding="UTF-8"
indent="yes" />
<xsl:template match="/Main">
<table class="std" width="700px">
<form name="form" action="/Address" method="get"">
<tr><td colspan="2" class="std">
<xsl:apply-templates select="DisplayTime"/>
<xsl:apply-templates select="PrintTime"/>
</td>
</tr></form></table>
</xsl:template>
<xsl:template name="DisplayTime" match="DisplayTime">
<xsl:variable name="wert" select="name()" />
<xsl:for-each select="@*">
<xsl:variable name="DDTattr" select="name()" />
<xsl:variable name="DDTattrwert" select="." />
<xsl:choose>
<xsl:when test="$DDTattrwert='True'">
<input type="checkbox" name="DisplayTime_{$DDTattr}"
checked="checked">
Display Time
</input>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="PrintTime" match="PrintTime">
<xsl:variable name="wert" select="name()" />
<xsl:for-each select="@*">
<xsl:variable name="PTattr" select="name()" />
<xsl:variable name="PTattrwert" select="." />
/****** Here I need a choose/when on the Element 'Aktiviert' of
DisplayTime: ******/
<xsl:choose>
<xsl:when test="//DisplayTime/Aktiviert='True'">
/****** But I don't know how I can get it! *****/
<xsl:choose>
<xsl:when test="$DDTattrwert='True'">
<input type="checkbox"
name="DisplayTime_{$DDTattr}" checked="checked">
Display Time
</input>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
How does the statement have to look like to get the Value of the
DisplayTime element when I am in PrintTime?
Greetings
Kniffel
I do a xsl-transformation. And I try to get a Attribute, but I cannot
get it. My XML/XSL experience is not very good at the moment.
I have something like this:
TEST.xml
--------------
<?xml version="1.0" encoding="utf-8"?>
<Main>
<DisplayTime Aktiviert="True" />
<PrintTime Aktiviert="True" />
</Main>
TEST.xsl
-------------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xslutput method="html" version="1.0" encoding="UTF-8"
indent="yes" />
<xsl:template match="/Main">
<table class="std" width="700px">
<form name="form" action="/Address" method="get"">
<tr><td colspan="2" class="std">
<xsl:apply-templates select="DisplayTime"/>
<xsl:apply-templates select="PrintTime"/>
</td>
</tr></form></table>
</xsl:template>
<xsl:template name="DisplayTime" match="DisplayTime">
<xsl:variable name="wert" select="name()" />
<xsl:for-each select="@*">
<xsl:variable name="DDTattr" select="name()" />
<xsl:variable name="DDTattrwert" select="." />
<xsl:choose>
<xsl:when test="$DDTattrwert='True'">
<input type="checkbox" name="DisplayTime_{$DDTattr}"
checked="checked">
Display Time
</input>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="PrintTime" match="PrintTime">
<xsl:variable name="wert" select="name()" />
<xsl:for-each select="@*">
<xsl:variable name="PTattr" select="name()" />
<xsl:variable name="PTattrwert" select="." />
/****** Here I need a choose/when on the Element 'Aktiviert' of
DisplayTime: ******/
<xsl:choose>
<xsl:when test="//DisplayTime/Aktiviert='True'">
/****** But I don't know how I can get it! *****/
<xsl:choose>
<xsl:when test="$DDTattrwert='True'">
<input type="checkbox"
name="DisplayTime_{$DDTattr}" checked="checked">
Display Time
</input>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
How does the statement have to look like to get the Value of the
DisplayTime element when I am in PrintTime?
Greetings
Kniffel