Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xsl: grouping radiobuttons by name; name should be position of parent node

From: Paul R <completely.fictitious@-----.--->
To: NULL
Date: 2/1/2005 4:14:00 PM
discomiller wrote:
> Mario Mueller:
> 
> Hello *,
> 
> radiobuttons belong to other radiobuttons by the "name="any_value""
> attribut.
> Thats a fakt.
> 
> I got the following XML:
> **************************************************************
> <?xml version="1.0" encoding="iso-8859-1"?>
> <?xml-stylesheet href="number4.xsl" type="text/xsl"?>
> <fragekatalog>
> 
> 	<frage1 text="Gibt es bei Ihnen derzeit lediglich All-Inclusive
> Produkte, die implizit die Netzkosten mit abrechnen oder gibt es
> bereits heute Produkte in denen die reinen Netzkosten als expliziter
> Bestandteil den Kunden gegenüber ausgewiesen werden?">
> 		<radiobutton1>Nur All-Inclusive-Produkte</radiobutton1>
> 		<frage2 text="Gibt es in den bestehenden All-In-Abrechnungsmodellen
> bereits Tarife, die ausschließlich der Ermittlung statistischer
> Netzbestandteile dienen?">
> 			<radiobutton2>Ja</radiobutton2>
> 			<frage3 text="Sind diese derzeit durch entsprechende
> buchungsrelevante Zeilen mit Gegen-buchungsschritten im Hintergrund
> oder durch nicht buchungsrelevante informatorische Zeilen realisiert? 
> ">
> 				<radiobutton3>buchungsrelevante Zeilen mit</radiobutton3>
> 				<radiobutton3>informatorische Zeilen</radiobutton3>
> 			</frage3>
> 		</frage2>
> 		<radiobutton1>All-In-Produkte und Netz+Energie separat
> ausgewiesene</radiobutton1>
> 		<frage2 text="Gibt es in den bestehenden All-In-Abrechnungsmodellen
> bereits Tarife, die ausschließlich der Ermittlung statistischer
> Netzbestandteile dienen?">
> 			<radiobutton2>Ja</radiobutton2>
> 			<frage3 text="Sind diese derzeit durch entsprechende
> buchungsrelevante Zeilen mit Gegen-buchungsschritten im Hintergrund
> oder durch nicht buchungsrelevante informatorische Zeilen realisiert? 
> ">
> 				<radiobutton3>buchungsrelevante Zeilen mit</radiobutton3>
> 				<radiobutton3>informatorische Zeilen</radiobutton3>
> 			</frage3>
> 			<radiobutton2>Nein</radiobutton2>
> 		</frage2>
> 		<radiobutton1>Nur seperat ausgewiesene</radiobutton1>
> 	</frage1>
> </fragekatalog>
> *******************************************************************
> and I have a XSL:
> *******************************************************************
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:template match="/">
> 		<html>
> 			<xsl:apply-templates select="fragekatalog/titel"/>
> 			<body bgcolor="#C0C0C0">
> 				<xsl:apply-templates select="fragekatalog/frage1"/>
> 			</body>
> 		</html>
> 		<!-- Ende <xsl:template match="/"> -->
> 	</xsl:template>
> 	<xsl:template match="titel">
> 		<head>
> 			<meta content="text/html; charset=ISO-8859-1"
> http-equiv="content-type"/>
> 			<basefont size="0" color="#000000"
> face="Courier,Arial,Helvetica,sans-serif"/>
> 			<p>
> 				<img src="bilder/dsc.gif" alt="dsc"/>
> 			</p>
> 			<br/>
> 			<br/>
> 			<title>
> 				<xsl:value-of select="."/>
> 			</title>
> 		</head>
> 		<!-- Ende <xsl:template match="titel"> -->
> 	</xsl:template>
> 	<xsl:template match="frage1">
> 		<!--<h1>Meine frage1</h1>-->
> 		<br/>
> 		<font color="#000000">
> 			<table border="1" bgcolor="#F5F5DC" width="100%" rules="all">
> 				<tr>
> 					<!-- Farbe Überschrift einer Tabelle -->
> 					<th align="left" bgcolor="#DEB887" colspan="6">
> 						<span style="font-weight: normal;">
> 							<xsl:value-of select="@text"/>
> 						</span>
> 					</th>
> 				</tr>
> 				<font color="#000000">
> 					<xsl:apply-templates/>
> 				</font>
> 			</table>
> 		</font>
> 		<br/>
> 		<br/>
> 		<br/>
> 		<!-- <xsl:template match="frage1"> Ende-->
> 	</xsl:template>
> 	<xsl:template match="radiobutton1">
> 		<tr>
> 			<!-- Farbe Radiobutton1 -->
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)"/>
> 				<input type="radio" witdh="10" name="{$rowID}" value="{$rowID}">
> 				</input>
> 			</td>
> 			<!-- Farbe Text zu Radiobutton1 -->
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 			</td>
> 			<!-- falls frage1 1 vorhanden -->
> 			<xsl:apply-templates select="frage2"/>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="checkbox1">
> 		<tr>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)"/>
> 				<input type="checkbox" witdh="10" value="./" name="/."
> onclick="funcRadioButton()">
> 				</input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="textarea">
> 		<tr>
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<TEXTAREA name="textarea1" value="" rows="3" wrap="on" cols="70">
> 					<xsl:value-of select="textarea1"/>
> 				</TEXTAREA>
> 				<!--<xsl:value-of select="."/>-->
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<!--********- <xsl:template matches für frage2
> -********************-->
> 	<!--********- <xsl:template matches für frage2
> -********************-->
> 	<!--********- <xsl:template matches für frage2
> -********************-->
> 	<!--********- <xsl:template matches für frage2
> -********************-->
> 	<xsl:template match="frage2">
> 		<font color="#000000">
> 			<tr>
> 				<td>
> 					<th align="left" bgcolor="#DEB887" colspan="2">
> 						<span style="font-weight: normal;">
> 							<xsl:value-of select="@text"/>
> 						</span>
> 					</th>
> 				</td>
> 			</tr>
> 		</font>
> 		<xsl:apply-templates/>
> 		<!-- <xsl:template match="frage"> Ende-->
> 	</xsl:template>
> 	<xsl:template match="checkbox2">
> 		<tr>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*10"/>
> 				<input type="checkbox" witdh="10" value="./" name="/."
> onclick="funcRadioButton()">
> 				</input>
> 			</td>
> 			<td>
> 				<xsl:value-of select="checkbox2"/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="radiobutton2">
> 		<tr>
> 			<td>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*10"/>
> 				<input type="radio" witdh="10" name="{$rowID}" value="{$rowID}">
> 				</input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 				<xsl:apply-templates select="frage3"/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="textarea2">
> 		<tr>
> 			<td/>
> 			<td>
> 				<TEXTAREA name="textarea" value="" rows="3" wrap="on" cols="70">
> 					<xsl:value-of select="textarea2"/>
> 				</TEXTAREA>
> 				<!--<xsl:value-of select="."/>-->
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<!--********- <xsl:template matches für frage3
> -********************-->
> 	<!--********- <xsl:template matches für frage3
> -********************-->
> 	<!--********- <xsl:template matches für frage3
> -********************-->
> 	<xsl:template match="frage3">
> 		<font color="#000000">
> 			<tr>
> 				<td/>
> 				<td>
> 					<!-- dscmm 01022005 >>> -->
> 					<xsl:param name="mypara" select="position()"/>
> 					<xsl:value-of select="position()"/>
> 					<!-- dscmm 01022005 <<< -->
> 					<xsl:value-of select="mypara"/>
> 					<th align="left" bgcolor="#DEB887" colspan="2">
> 						<span style="font-weight: normal;">
> 							<xsl:value-of select="@text"/>
> 						</span>
> 					</th>
> 				</td>
> 			</tr>
> 		</font>
> 		<xsl:apply-templates/>
> 		<!-- <xsl:template match="frage3"> Ende-->
> 	</xsl:template>
> 	<xsl:template match="checkbox3">
> 		<tr>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*100"/>
> 				<Input type="checkbox" value="./" name="/."
> onclick="funcRadioButton()">
> 				</Input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="checkbox2"/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="radiobutton3">
> 		<tr>
> 			<!-- <td> -->
> 			<!--  <xsl:number format="01" count="//frage"/> -->
> 			<!--  </td> -->
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<!-- 	<xsl:variable name="rowID" select="position()" 
> 
>></xsl:variable> -->
> 
> 				<xsl:variable name="rowID" select="//frage3"/>
> 				<input type="radio" name="{$rowID}" value="{$rowID}">
> 				</input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 				<xsl:apply-templates select="frage3"/>
> 			</td>
> 			<!-- falls Frage 1 vorhanden -->
> 			<!-- 	<xsl:apply-templates select="radiobutton3"/> -->
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="textarea3">
> 		<tr>
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<TEXTAREA name="textarea" value="" rows="3" wrap="on" cols="70">
> 					<xsl:value-of select="."/>
> 				</TEXTAREA>
> 				<!--<xsl:value-of select="."/>-->
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<!--********- <xsl:template matches für frage4
> -********************-->
> 	<!--********- <xsl:template matches für frage4
> -********************-->
> 	<!--********- <xsl:template matches für frage4
> -********************-->
> 	<xsl:template match="frage4">
> 		<font color="#000000">
> 			<tr>
> 				<td/>
> 				<td/>
> 				<td>
> 					<th align="left" bgcolor="#DEB887" colspan="2">
> 						<span style="font-weight: normal;">
> 							<xsl:value-of select="@text"/>
> 						</span>
> 					</th>
> 				</td>
> 			</tr>
> 		</font>
> 		<xsl:apply-templates/>
> 		<!-- <xsl:template match="frage4"> Ende-->
> 	</xsl:template>
> 	<xsl:template match="checkbox4">
> 		<tr>
> 			<!-- <td> -->
> 			<!-- <xsl:number format="01" count="checkbox"/> -->
> 			<!-- </td> -->
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*1000"/>
> 				<input type="checkbox" value="./" name="/."
> onclick="funcRadioButton()">
> 				</input>
> 			</td>
> 			<td bgcolor="#3366FF">
> 				<xsl:value-of select="checkbox2"/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="radiobutton4">
> 		<tr>
> 			<!-- <td> -->
> 			<!--  <xsl:number format="01" count="//frage"/> -->
> 			<!--  </td> -->
> 			<td/>
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*1000"/>
> 				<input type="radio" name="{$rowID}" value="{$rowID}">
> 				</input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 				<xsl:apply-templates select="frage4"/>
> 			</td>
> 			<!-- falls Frage 1 vorhanden -->
> 			<!-- 	<xsl:apply-templates select="radiobutton4"/> -->
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="textarea4">
> 		<tr>
> 			<td/>
> 			<td>
> 				<TEXTAREA name="textarea" value="" rows="3" wrap="on" cols="70">
> 					<xsl:value-of select="textarea4"/>
> 				</TEXTAREA>
> 				<!--<xsl:value-of select="."/>-->
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<!--********- <xsl:template matches für frage5
> -********************-->
> 	<!--********- <xsl:template matches für frage5
> -********************-->
> 	<!--********- <xsl:template matches für frage5
> -********************-->
> 	<xsl:template match="frage5">
> 		<font color="#000000">
> 			<tr>
> 				<td/>
> 				<td/>
> 				<td/>
> 				<td>
> 					<th align="left" bgcolor="#DEB887" colspan="2">
> 						<span style="font-weight: normal;">
> 							<xsl:value-of select="@text"/>
> 						</span>
> 					</th>
> 				</td>
> 			</tr>
> 		</font>
> 		<xsl:apply-templates/>
> 		<!-- <xsl:template match="frage5"> Ende-->
> 	</xsl:template>
> 	<xsl:template match="checkbox5">
> 		<tr>
> 			<!-- <td> -->
> 			<!-- <xsl:number format="01" count="checkbox"/> -->
> 			<!-- </td> -->
> 			<td/>
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*10000"/>
> 				<input type="checkbox" value="./" name="/."
> onclick="funcRadioButton()">
> 				</input>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="checkbox2"/>
> 			</td>
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="radiobutton5">
> 		<tr>
> 			<!-- <td> -->
> 			<!--  <xsl:number format="01" count="//frage"/> -->
> 			<!--  </td> -->
> 			<td/>
> 			<td/>
> 			<td/>
> 			<td/>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*10000"/>
> 				<input type="radio" name="{$rowID}" value="{$rowID}"/>
> 			</td>
> 			<td bgcolor="#F8F8FF">
> 				<xsl:value-of select="."/>
> 				<xsl:apply-templates select="frage5"/>
> 			</td>
> 			<!-- falls Frage 1 vorhanden -->
> 			<!-- 	<xsl:apply-templates select="radiobutton5"/> -->
> 		</tr>
> 	</xsl:template>
> 	<xsl:template match="textarea5">
> 		<tr>
> 			<td/>
> 			<td>
> 				<td/>
> 				<TEXTAREA bgcolor="#F8F8FF" name="textarea" value="" rows="3"
> wrap="on" cols="70">
> 					<xsl:value-of select="textarea5"/>
> 				</TEXTAREA>
> 				<!--<xsl:value-of select="."/>-->
> 			</td>
> 		</tr>
> 	</xsl:template>
> </xsl:stylesheet>
> *************************************************************************
> the output is:
> *************************************************************************
> <html><body bgcolor="#C0C0C0"><br><font color="#000000"><table
> border="1" bgcolor="#F5F5DC" width="100%" rules="all"><tr><th
> align="left" bgcolor="#DEB887" colspan="6"><span style="font-weight:
> normal;">Gibt es bei Ihnen derzeit lediglich All-Inclusive Produkte,
> die implizit die Netzkosten mit abrechnen oder gibt es bereits heute
> Produkte in denen die reinen Netzkosten als expliziter Bestandteil den
> Kunden gegenüber ausgewiesen werden?</span></th></tr><font
> color="#000000">
> 		<tr><td bgcolor="#F8F8FF"><input type="radio" witdh="10" name="0"
> value="0"></td><td bgcolor="#F8F8FF">Nur
> All-Inclusive-Produkte</td></tr>
> 		<font color="#000000"><tr><td><th align="left" bgcolor="#DEB887"
> colspan="2"><span style="font-weight: normal;">Gibt es in den
> bestehenden All-In-Abrechnungsmodellen bereits Tarife, die
> ausschließlich der Ermittlung statistischer Netzbestandteile
> dienen?</span></th></td></tr></font>
> 			<tr><td></td><td bgcolor="#F8F8FF"><input type="radio" witdh="10"
> name="10" value="10"></td><td bgcolor="#F8F8FF">Ja</td></tr>
> 			<font color="#000000"><tr><td></td><td><th align="left"
> bgcolor="#DEB887" colspan="2"><span style="font-weight: normal;">Sind
> diese derzeit durch entsprechende buchungsrelevante Zeilen mit
> Gegen-buchungsschritten im Hintergrund oder durch nicht
> buchungsrelevante informatorische Zeilen realisiert? 
> </span></th></td></tr></font>
> 				<tr><td></td><td></td><td bgcolor="#F8F8FF"><input type="radio"
> name="100" value="100"></td><td bgcolor="#F8F8FF">buchungsrelevante
> Zeilen mit</td></tr>
> 				<tr><td></td><td></td><td bgcolor="#F8F8FF"><input type="radio"
> name="100" value="100"></td><td bgcolor="#F8F8FF">informatorische
> Zeilen</td></tr>
> 			
> 		
> 		<tr><td bgcolor="#F8F8FF"><input type="radio" witdh="10" name="0"
> value="0"></td><td bgcolor="#F8F8FF">All-In-Produkte und Netz+Energie
> separat ausgewiesene</td></tr>
> 		<font color="#000000"><tr><td><th align="left" bgcolor="#DEB887"
> colspan="2"><span style="font-weight: normal;">Gibt es in den
> bestehenden All-In-Abrechnungsmodellen bereits Tarife, die
> ausschließlich der Ermittlung statistischer Netzbestandteile
> dienen?</span></th></td></tr></font>
> 			<tr><td></td><td bgcolor="#F8F8FF"><input type="radio" witdh="10"
> name="30" value="30"></td><td bgcolor="#F8F8FF">Ja</td></tr>
> 			<font color="#000000"><tr><td></td><td><th align="left"
> bgcolor="#DEB887" colspan="2"><span style="font-weight: normal;">Sind
> diese derzeit durch entsprechende buchungsrelevante Zeilen mit
> Gegen-buchungsschritten im Hintergrund oder durch nicht
> buchungsrelevante informatorische Zeilen realisiert? 
> </span></th></td></tr></font>
> 				<tr><td></td><td></td><td bgcolor="#F8F8FF"><input type="radio"
> name="100" value="100"></td><td bgcolor="#F8F8FF">buchungsrelevante
> Zeilen mit</td></tr>
> 				<tr><td></td><td></td><td bgcolor="#F8F8FF"><input type="radio"
> name="100" value="100"></td><td bgcolor="#F8F8FF">informatorische
> Zeilen</td></tr>
> 			
> 			<tr><td></td><td bgcolor="#F8F8FF"><input type="radio" witdh="10"
> name="30" value="30"></td><td bgcolor="#F8F8FF">Nein</td></tr>
> 		
> 		<tr><td bgcolor="#F8F8FF"><input type="radio" witdh="10" name="0"
> value="0"></td><td bgcolor="#F8F8FF">Nur seperat
> ausgewiesene</td></tr>
> 	</font></table></font><br><br><br></body></html>
> ************************************************************************
> the problem: the first two radiobuttons are connected wird radiobutton
> 3 & 4 because of name="100"
> 100 ist created in 	<xsl:template match="radiobutton3">
> <xsl:variable name="rowID"
> select="count(../preceding-sibling::*)*100">
> --> I count the parent nodes and here there ist the fault.
> To get an idenfifier I have to use the "position()"-attribut, but
> there is no way to get the position-value of the parent node.
> 
> I don't want to change the XML, just the XSL.
> 
> Is there an other way to get a identifier to group radiobuttons on
> exery hierarchie-level?
> 
> Thanks a lot
I think instead of count(../preceding-sibling::*) you want
count(../preceding::*|../ancestor::*)


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent