Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 15th, 2007, 02:49 PM
Registered User
Join Date: May 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default enabling controls built in XSLT and imported

I have a customer that wants a table of contents built inside a dropdown list box. The problem is that the material for the book is in an XML file, the webform connects the XML with an XSLT file. A profile variable contains the filename of the chapter to be built. There is more than one book so the webform in the builder knows nothing about contents until runtime. All appears to work correctly until time for asp to parse the controls. The controls are coming out as
<asp:linkbutton name="chapter1Link" runat="server" OnClick="chapter1Link_Click">Chapter1</asp:linkbutton>
<a id="chapter1lin " href="javascript:__doPostBack('chapter1Link','')">Chapter1</a>
Here is a sample of the simular code

<?xml version="1.0" encoding="utf-16" ?>
<?xml-stylesheet href="ChapterConverter.xsl" type="text/xsl"?>
<chapter number="6" title="Fashion Week: Presenting the Collections To the Buyers">

    <col position="left">
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras lacinia rhoncus 
      ante. Ut non neque. Quisque elementum dolor id purus. Nam ultrices enim eget dolor. 
      Sed sit amet lectus. Cras leo sapien, tristique sit amet, blandit mollis, tempus sed, metus. 
      Sed ut odio in nibh vestibulum congue. Integer rhoncus sapien. Fusce diam dui, dictum ut, 
      congue sit amet, egestas quis, erat. Cras massa metus, pellentesque a, vestibulum vel, 
      luctus sed, nisi. Proin nulla dolor, egestas ut, interdum nec, ultricies ac, felis. Aliquam 
      vel mi sit amet eros venenatis eleifend. Integer facilisis sagittis urna. Nunc vitae metus. 
      In placerat, est quis gravida accumsan, tellus lacus imperdiet nulla, non mattis felis pede in ante.
    <col position="middle">
      Mauris vestibulum velit et elit. Nam risus nibh, lacinia a, interdum id, sollicitudin sed, nibh. Nunc eget 
      enim in leo ultrices lobortis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur 
      ridiculus mus. Proin pharetra dui sed enim. Vestibulum ante ipsum primis in faucibus orci luctus 
      et ultrices posuere cubilia Curae; Proin accumsan, felis vitae feugiat interdum, est odio lobortis leo, 
      non molestie nisl tortor nec leo. Aenean justo. Ut orci metus, feugiat sit amet, dictum ac, 
      condimentum nec, massa. Pellentesque eu nunc at augue accumsan rhoncus. Nulla scelerisque.
    <col position="right">
      Maecenas a massa. Nulla facilisi. Nam venenatis risus a felis. Pellentesque aliquet felis eget 
      tellus. Sed et erat non diam lobortis congue. Etiam et tellus. Proin eget eros sit amet leo 
      rhoncus ullamcorper. Aenean ut nulla. Nunc diam. Nam interdum. Curabitur id lorem. Aliquam 
      consequat ultrices libero.
  Chapter Converter Translation file
  Purpose: Take Chapter XML File and convert it to XHTML 1.0 Strict
  Author: Charles Russell 
  Creation Date:1/10/07

  Notes: In some areas concatenation could be used but for clarity of purpose if statements were used instead
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"

  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

  <xsl:template match="chapter">
    <div id="wall">
      <div id="menu">
        <a href="#">Key</a>
        <br />
        <br />
        <select name="Chapter">
          <option value="chapter1">
            <asp:linkbutton name="chapter1Link" runat="server" OnClick="chapter1Link_Click">Chapter1</asp:linkbutton>
            <asp:linkbutton name="chapter2Link" runat="server" OnClick="chapter2Link_Click">Chapter2</asp:linkbutton>
            <asp:linkbutton name="chapter3Link" runat="server" OnClick="chapter3Link_Click">Chapter3</asp:linkbutton>
            <asp:linkbutton name="chapter4Link" runat="server" OnClick="chapter4Link_Click">Chapter4</asp:linkbutton>
            <asp:linkbutton name="chapter5Link" runat="server" OnClick="chapter5Link_Click">Chapter5</asp:linkbutton>
            <asp:linkbutton name="chapter6Link" runat="server" OnClick="chapter6Link_Click">Chapter6</asp:linkbutton>
        <br />
        <br />
        <a href="#">Index/Search</a>
        <br />
      <div id="container">
        <div id="internalFrame">
          <div id="chapter_banner">

            Chapter <xsl:value-of select="@number"/>

            <br />


  <xsl:template match="ChapterIntro">
    <div id="chapter_intro" class="clearfix">

      <div id="col1">

        <xsl:value-of select="./col[@position='left']"  disable-output-escaping="no"/>


      <div id="col2">

        <xsl:value-of select="./col[@position='middle']"  disable-output-escaping="no" />


      <div id="col3">

        <xsl:value-of select="./col[@position='right']"  disable-output-escaping="no"/>



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="builder.aspx.cs" Inherits="builder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <link href="style.css" type="text/css" rel ="stylesheet"/>
    <title>Untitled Page</title>
    <form id="form1" runat="server">

using System;
using System.Text;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Xsl;

public partial class builder : System.Web.UI.Page
    private StringWriter ChapterStringBuild = new StringWriter(); //contains Chapter content
    private XslCompiledTransform XslBaseConverter = new XslCompiledTransform();
    private XsltArgumentList Args = new XsltArgumentList();

    protected void Page_Init(object sender, EventArgs e)

        XslBaseConverter.Load(Request.PhysicalApplicationPath + "XSLTFile.xsl");
        XslBaseConverter.Transform(Request.PhysicalApplicationPath + Profile.CurrentFile, Args, ChapterStringBuild);
        string outString = ChapterStringBuild.ToString();
        outString = outString.Replace("xmlns:asp=\"remove\"", "");
        outString = outString.Replace("xmlns=\"\"", "");
        form1.InnerHtml = outString;
        Control ctrl = Page.ParseControl(form1.InnerHtml);


    protected void chapter1Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap1.xml";


    protected void chapter2Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap2.xml";


    protected void chapter3Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap3.xml";


    protected void chapter4Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap4.xml";

    protected void chapter5Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap5.xml";

    protected void chapter6Link_Click(object sender, EventArgs e)
        Profile.CurrentFile = "Chap6.xml";



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit an imported template, where & how? ismailc XSLT 2 January 18th, 2008 03:50 AM
ASP.NET COntrols inside XSLT sani723 XSLT 8 March 22nd, 2007 07:15 AM
Enabling/Disabling Form Controls lbyii Javascript 6 October 13th, 2006 07:36 AM
imported DLL functions in MFC atmosphere Visual C++ 0 June 4th, 2006 08:30 PM
Delimited fields imported to one column in access raaghu15 Access VBA 1 February 23rd, 2005 12:49 PM

All times are GMT -4. The time now is 12:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.