1 pièce(s) jointe(s)
generation dynamique des pages ASP.net a partir d'un fichier XML
bonjour,
je veux crée un page web principal ASP.NET dans la quelle il existe 3 lien et chaque lien va amener a une autre page.
la difficulté est que les 3 pages sont de pages créant a partir d'un fichier XML comme ca marche jusqu'a maintenant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?xml version="1.0" encoding="utf-8"?>
<FORM>
<PAGES>
<PAGE title="Page 3" id="page_3">
<FIELDS>
</FIELDS>
</PAGE>
<PAGE title="wawaawwawawawawawawaw" id="page_2">
<FIELDS>
</FIELDS>
</PAGE>
<PAGE title="Page 1" id="page_1">
<FIELDS>
</FIELDS>
</PAGE>
</PAGES>
</FORM> |
et fichier xslt:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| <?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="remove">
<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes"></xsl:output>
<xsl:template match="/">
<xsl:param name="pageid"/>
<!-- start form page -->
<table cellpadding="0" cellspacing="5">
<!-- set title of the current page -->
<tr>
<td colspan="3" align="center" style="font-size:25px">
<xsl:value-of select="FORM/PAGES/PAGE[@id='page_2']/@title" />
</td>
</tr>
<xsl:for-each select="FORM/PAGES/PAGE[@id='page_2']/FIELDS/FIELD">
<xsl:element name="tr">
<xsl:attribute name="id">
TR_<xsl:value-of select="PROPERTIES/PROPERTY[@name='ID']"></xsl:value-of>
</xsl:attribute>
<!-- hide the row -->
<xsl:if test="@display='none'">
<xsl:attribute name="style">display:none;</xsl:attribute>
</xsl:if>
<xsl:choose>
<!-- html control -->
<xsl:when test="@type='HTML'">
<td colspan="3">
<!-- #include file="<xsl:value-of select="@src"></xsl:value-of>" -->
</td>
</xsl:when>
<!-- other controls -->
<xsl:otherwise>
<!-- field label column -->
<td valign="top">
<xsl:value-of select="@label" />
</td>
<!-- field column -->
<td>
<!-- field element -->
<xsl:element name="asp:{@type}">
<xsl:attribute name="runat">server</xsl:attribute>
<xsl:for-each select="./PROPERTIES/PROPERTY">
<xsl:attribute name="{@name}">
<xsl:value-of select="current()"></xsl:value-of>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="./LISTITEMS/LISTITEM">
<asp:ListItem value="{@value}">
<xsl:value-of select="current()"></xsl:value-of>
</asp:ListItem>
</xsl:for-each>
</xsl:element>
</td>
<!-- validation message column -->
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet> |
et la page Asp.net
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>TEST Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton3" runat="server">Button 3</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server">Button 2</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Button 1</asp:LinkButton></form>
</body>
</html> |
problème comment lorsque on clique sur le boutton 1 va amener a la page 1 qui est crée dans le fichier XML et xslt de même pour le boutton 2 je clique sur ceci va amener a la page 2...
:cry::
vous trouvez le projet ci-joint
Merci