Outputting ASP.NET tags using XSLT

Hi,

Oleg's answer about attribute value templates led me to look back at a
different problem, and wonder if someone else had solved it.

I want to output an ASP.NET page. Thus I need to output ASP.NET tags and
HTML tags.

<%@ Page Language= etc...

and
<HTML> etc.

OK, so I use html output and can't get the directive output. <% gives an
error and &lt;% outputs exactly that which Visual Studio (at least) fails to
regonize.

So I use text output, and can get the page directive output correctly using
&lt;%. However, I have to escape everysingle < in the file, or the tag is
ignored and not output.  It works, but man is it ugly.

A sample is below so you can point out any issues you see with it. The
garbage namespaces are from some messing around I was doing this morning on
the problem (it currently fails to output the HTML tags).
-- 
Kathleen Dollard
Microsoft MVP
Author "Code Generation in Microsoft .NET"



<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:dbs="http://kadgen/DatabaseStructure"
   xmlns:orm="http://kadgen.com/KADORM.xsd"
   xmlns:ui="http://kadgen.com/UserInterface.xsd"
   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
   xmlns:net="http://kadgen.com/StandardNETSupport.xsd"
   xmlns:asp="asdf"
   xmlns:uc1="QWER"
   xmlns=" HTMLSDFTUF">
<xsl:import href="webSupport.xslt"/>
<xsl:import href="../../Chapter 8/BusinessObjects/CSLASupport.xslt"/>
<xsl:output method="text" encoding="UTF-8" indent="yes"/>
<xsl:preserve-space elements="*" />

<xsl:param name="Name"/>
<xsl:param name="filename"/>
<xsl:param name="database"/>
<xsl:param name="gendatetime"/>
<xsl:param name="BusinessObject"/>

<xsl:variable name="projnamespace" select="//ui:UIRoot/@ProjectNamespace"/>
<xsl:variable name="objectname" select="$BusinessObject"/>
<xsl:variable name="objectsingular"
                  select="//orm:Object[@Name=$objectname]/@Name"/>

<xsl:template match="/">
 <xsl:apply-templates select="//orm:Object[@Name=$objectname]"
        mode="Object"/>
</xsl:template>

<xsl:template match="orm:Object" mode="Object">
&lt;%@ Page Language="vb" AutoEventWireup="false"
         Codebehind="<xsl:value-of select="$objectsingular"/>Edit.aspx.vb"
         Inherits="<xsl:value-of
select="concat($projnamespace,'.codebehind',
                         $objectsingular)"/>Edit"%>
&lt;%@ Register TagPrefix="uc1" TagName="Header" Src="..\..\Header.ascx" %>
<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">-->
<HTML>
   <HEAD>
      <title><xsl:value-of select="$objectsingular"/>Edit</title>
      <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"/>
      <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"/>
      <meta content="JavaScript" name="vs_defaultClientScript"/>
      <meta content="http://schemas.microsoft.com/intellisense/ie5"
                  name="vs_targetSchema"/>
   </HEAD>
   <body>
      <form id="{$objectsingular}Edit"
                  method="post" runat="server">
         <P>
            <uc1:header id="Header1" runat="server">
            </uc1:header>
         </P>
         <P>
            <asp:label id="Label2"
                  runat="server" Font-Names="Bauhaus 93"
Font-Size="XX-Large">
               Edit <xsl:value-of select="$objectsingular"/>
            </asp:label></P>
      </form>
   </body>
</HTML>

</xsl:template>


</xsl:stylesheet>
<%@ Page Language="vb" AutoEventWireup="false"
         Codebehind="AssignmentEdit.aspx.vb"
         Inherits="WebPTracker.codebehindAssignmentEdit"%>
<%@ Register TagPrefix="uc1" TagName="Header" Src="..\..\Header.ascx" %>
AssignmentEdit
               Edit Assignment


0
1/1/2004 4:29:54 PM
dotnet.xml 7266 articles. 0 followers. Follow

8 Replies
674 Views

Similar Articles

[PageSpeed] 57

Kathleen Dollard wrote:

> I want to output an ASP.NET page. Thus I need to output ASP.NET tags and
> HTML tags.

This is what disable-output-escaping feature was disagned to facilitate, 
see http://www.w3.org/TR/xslt#disable-output-escaping.
disable-output-escaping feature is greately abused by people, but it's 
primary goal is to allow to output nonXML/nonHTML formats, such as 
ASP/JSP/XQuery/SQL/etc.

> <%@ Page Language= etc...
> 
> and
> <HTML> etc.
> 
> OK, so I use html output and can't get the directive output. <% gives an
> error and &lt;% outputs exactly that which Visual Studio (at least) fails to
> regonize.

Try
<xsl:text disable-output-escaping="yes">&lt;%@ Page language="c#" 
%></xsl:text>

This allows to output ASP tags while transforming using HTML or XML 
output method.

-- 
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
0
Oleg
1/1/2004 6:11:19 PM
Oleg Tkachenko <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message news:<OxMP1JJ0DHA.1684@TK2MSFTNGP12.phx.gbl>...
> Kathleen Dollard wrote:
> 
> > I want to output an ASP.NET page. Thus I need to output ASP.NET tags and
> > HTML tags.
> 
> This is what disable-output-escaping feature was disagned to facilitate, 
> see http://www.w3.org/TR/xslt#disable-output-escaping.
> disable-output-escaping feature is greately abused by people, but it's 
> primary goal is to allow to output nonXML/nonHTML formats, such as 
> ASP/JSP/XQuery/SQL/etc.

While Oleg is right about DOE, I'd recommend not to use DOE even in
such cases (as it may become a little bad habbit).

The attribute value: method="text" was intended for cases exactly like
this.

Certainly, one has to escape all "<" and "&" characters, but this will
help to never forget that the result is *not* a well-formed xml
document.

Another approach, which probably is the best compromise between
convenience and to using 100% conformant features of XSLT, is to use a
dummy namespace, bind the "asp" prefix to it, perform the
transformation and then update the result and remove the namespace
declaration.


Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
0
dimitren (11)
1/5/2004 1:07:55 PM
I gave got a similar problem as discussed, but I have added the recommendations to my code at it still does not work.  Has anyone got a simple solution that they can share with me?  i.e. just one user control returning XM

I would bery much appreciate any examples or references as this thing has been quite frustratin

Thankyou in advanced
0
3/2/2004 12:06:09 AM
>>This is what disable-output-escaping feature was disagned to facilitate, 
>>see http://www.w3.org/TR/xslt#disable-output-escaping.
>>disable-output-escaping feature is greately abused by people, but it's 
>>primary goal is to allow to output nonXML/nonHTML formats, such as 
>>ASP/JSP/XQuery/SQL/etc.
> 
> While Oleg is right about DOE, I'd recommend not to use DOE even in
> such cases (as it may become a little bad habbit).
> 
> The attribute value: method="text" was intended for cases exactly like
> this.
> 
> Certainly, one has to escape all "<" and "&" characters, but this will
> help to never forget that the result is *not* a well-formed xml
> document.

I've run into a similar problem, that basically runs along the same 
lines. I'm trying to use a FOR XML query with XmlDataDocument and I keep 
getting.

<NewDataSet>
   <Keywords>
     <XML_F52E2B61-18A1-11d1-B105-00805F49916B>
       &lt;nodeset&gt;
         Nodeset with all special characters escaped.
       &lt;/nodeset&gt;
     </XML_F52E2B61-18A1-11d1-B105-00805F49916B>
   </Keywords>
</NewDataSet>

Now, this may simply be a problem with how I'm doing it, but I still 
think it might be usefull to have an easy way to convert these to their 
character equivlents using XSL.

> Another approach, which probably is the best compromise between
> convenience and to using 100% conformant features of XSLT, is to use a
> dummy namespace, bind the "asp" prefix to it, perform the
> transformation and then update the result and remove the namespace
> declaration.

Is there a schema for the asp: tags used with asp.net?

0
Duck1 (5)
3/2/2004 3:10:09 AM

> Is there a schema for the asp: tags used with asp.net?

AFAIK, there's no asp xml schema.


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html




0
dnovatchev (74)
3/2/2004 5:45:59 AM
Anas M. Nebuchadnezzar XXXVII wrote:

> Is there a schema for the asp: tags used with asp.net?

ASP.NET syntax isn't XML, so I doubt there is a schema available.

-- 
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
0
Oleg
3/2/2004 8:33:02 AM
Hi Andrew,

Have you tried to use the disable-output-escaping feature? Here is an 
example:

<xsl:template match="description">
  <xsl:value-of select="." disable-output-escaping="yes" />
</xsl:template>

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no 
rights."

0
v-kevy (347)
3/2/2004 9:04:49 AM
"Dimitre Novatchev [MVP XML]" <dnovatchev@yahoo.com> wrote in message
news:c216cb$1obb4u$1@ID-152440.news.uni-berlin.de...
>
>
> > Is there a schema for the asp: tags used with asp.net?
>
> AFAIK, there's no asp xml schema.

And, of course, there cannot be one as ASP is not an application of XML.


0
dnovatchev (74)
3/2/2004 8:38:39 PM
Reply:

Similar Artilces:

second hand or used items
Does anyone know of a RMS mod that will handle taking in used merchandise and reselling it? We need a way to track many of the same item with the same UPC code individually because we can pay different amounts for each one over time. One idea i had was to generate our own unique UPC code for these items individually and put out own barcode on them. Is this the best method? Is there a mod to generate UPC codes? hi eric, you are on the right track i think the one way is to handle this is create the own upc code and sell it under this. you can easily track this way .. Akber "Er...

Automation of Excel Report using Access Data
I have data in a query that I have exported from Access using Transfer text to a csv file. I set up an excel spreadsheet for the report and recorded a macro in excel that imports the data from the csv file and links the data to the report. The problem is running the Excel macro as part of the code for the button click in my Acces form. I am getting a runtime error, saying that the macro cannot be found. Everything is spelled correctly. Can anyone provide any insight? Thanks Here is the code for the button click in Access: Dim xlsApp As Excel.Application Dim x...

Use Greylisting technology to block junk email
I tested many anti-spam software, such as brightmail, gif me11,etc, and last i found ORF Greylisting technology is one very good, it based on temporary rejection of emails from unknown senders, while greylisting provides an outstanding spam catch rate, it causes about 5 minutes delay of emails from unknown senders as well, and i use Automatic sender whitelist function to reduce the most delay, and i also use the SURBL feature. ORF Enterprise Edition include following features The list below describes the features of ORF Enterprise Edition in details. ..Filtering based on DNS blacklists...

OWA 2003 logon.asp mod.
I am trying to fiqure out how to modify my logon.asp page to remove or hide the domain portion of the logon. MS Knowledge Base Article #820378 describes how to accomplish this but I cannot fiqure out what needs to be modified and where. I cannot find what they want change in my logon.asp file. Anyone have a clue on this? Scott Scott A wrote: > I am trying to fiqure out how to modify my logon.asp page > to remove or hide the domain portion of the logon. MS > Knowledge Base Article #820378 describes how to accomplish > this but I cannot fiqure out what needs to be modified...

IM-Can I use it to update an item?
Hello, Assuming an integrated Inventory Item already exists in GP, if the item description is changed on the source data, can the item be updated through IM? If not, what are my other automated options? Thanks Jerry Yes. You would make your integration insert/update. from the IM integration properties. "Jerry" wrote: > Hello, > Assuming an integrated Inventory Item already exists in GP, if the item > description is changed on the source data, can the item be updated through > IM? If not, what are my other automated options? > Thanks > Jerry > > &...

Is it possible to use CRecordSet without connecting to a database?
Under .NET you can use the ADO.net object without never connecting to a database. Creating columns and inserting data manually. Is it possible to do so with a CRecordSet? If it is important to know, I need to do so because I have a working C++ function that accepts a CRecordSet derived class as a parameter (ugly, I know), I'd like to use the function and send it a RecordSet, just like it used to get before, however, all that without connecting to a database. - I'll fill it myself using another source. Is it possible? Thanks, Vitaly "Vitaly Belman" <vitalyb@gmail.com>...

#NAME? error using EDATE
Hi All, I have a situation where I upgraded a computer from Win98 to WinXP and now Excel 2000 files using EDATE for amortization schedule generates #NAME? error. For example: =EDATE(B14,1) generates #NAME? error where cell B14 has any date in it. This used to work before, but now doesn't work on other computers with Windows XP Pro and Excel 2000 either. Any ideas on how to solve this issue would be greatly appreciated. Thanks in advance. John Zimmermann You need to have the Analysis ToolPak installed. Go to Tools > Add-Ins. Once installed, press F9. HTH Jason Atlanta, GA >...

MSR Output Format
We are using a keyboard MSR and for the most part it works fine with Point of Sale. However there seems to be an output formatting issue with debit cards. We process Debit as credit. When swiping a Credit card everything works as expected. When swiping a some debit cards POS gives an error message that the expiration date is not valid. I can adjust the output settings for the MSR but I just need to know what to set them as to make it work. Thanks for the help. ...

Using contents of a cell in a formula
Hi, I'm trying to use the contents of a cell (as opposed to the actual cell) in a Formula. For example – in the following Statement: =AVERAGE(IF((PRICES!D$32848:D$34120=A44),PRICES!P$32848:P$34120)) Instead of using ‘PRICES!D$32848:D$34120’, I want to use the contents of another cell – lets say Cell A2’ Cell A2 would contain the character expression ‘PRICES!D$32848:D$34120’ So the statement above would read something like: =AVERAGE(IF((? A2 ?),PRICES!P$32848:P$34120)) How do I get the statement above to recognize the contents of cell A2 instead of cell A2? I know I could create ...

word crashes when using exit macros for a form field
Hi all, we have Word 2003 and I've programmed many applications for my agency using VBA macros; including several for forms. recently though, we've found some newer pcs will crash, if we have a form with an exit macro one a checkbox, and the exit macro does some significant processing (say running through a collection of fields looking for other checkboxes which are checked). What happens is that Word says it has encountered an error and must close when they click into another form field (this other form field *does not* have an entry macro). If I put an "e...

FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO VBScript, SAP
FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO VBScript, SAP - ABAP visit ebooks.univdatabase.com ...

output to cmd with | symbol
Hi. I am trying to call a cmd with some parameters. Unfortunately one of them is the | symbol. Here is the call i make: cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status" & vbtab & status & vbtab & "Backup completed ok" & chr(124) & "files=" & files & ", folders=" & folders &", bytes=" & bytes & chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog \send_nsca.cfg" wscript.echo cmd The call is trying ...

Re: Extracting Top 5 & Bottom 5 Variance for Revenu/Expendenture & Net Position #2
Hi All, if i had coloumns that had the title Revenue, Expenditure & Ne Position & under neath these Headings a row for each Revenue Expendenture & Net Position called Actuals then Budget then Variance My Question is what i would like is to be able to only have the Top 5 Bottom 5 Variances in all 3 Headings Revenue, Expendenture & Ne Position. How can i achieve this please. Would appreciate all th help. Thank you. Also each time i try to insert an attachment in this lette being excel it comes up as failure, why is thi -- william444 ------------------------------------------...

Using Word for large docuements.
Hello, I thought I would just ask to see if anyone had any tips for using Word (2003) for producing large documents. Im producing a user manual, which stands at 50+ pages, with many screen shot graphics, and Ive noticed in the past that previous versions of Word tended to get a bit quirky when they got to this size. Besides regular backups, has anybody got and tips on ensuring that the document remains "stable". Thanks TIm Did you mean to post in an Excel newsgroup? You'll probably get better answers in an MSWord newsgroup. Timboo wrote: > > Hello, I thought ...

PDF converter outputs weird font when opened through web browser
I used the PDF converter option in Publisher 2007 to create a pdf. It looked fine. However, when I put it on my website, it opened with a bizarre font that looked terrible. I can't figure out what the heck is going on, the font is embedded in the doc, and when I open it from my computer it looks fine. The only problem is opening it through a web browser. Later, a friend converted it for me using Acrobat Pro and the problem went away. Sounds like the converter but is the problem with Adobe or MS and is there a patch? The details: Font: Arial, embedded Save option: High quality print...

Using Find in an Exchange Environment
Hello Everybody! A user recently complained that he could only search through his Inbox to find emails that were sent August 2005 and before. Mail that was sent last week couldn't be found. I thought this this might have to do with the full text index that I have on that particular store. Unfortunatly this doesn't not seem to be the case. Any ideas would definitly help out big time! Dust On 18 Jul 2006 13:25:09 -0700, "Dust" <dustin.titus@gmail.com> wrote: >Hello Everybody! > >A user recently complained that he could only search through his Inbox >to fi...

Using MBCS & Dynamically linked MFC works on XP, but freezes on Vi
I have a large unmanaged C++/MFC application built using VS2005. It calls out to another third party set of COM components and one related DLL. The application runs fine on XP, but freezes when trying to make two specific calls on Vista: a) DLL function extern HRESULT GMSecureOEMCheckOEMProductString(LPWSTR OEMProductString); b) COM component property ptrRasterPropServ->PutFilename(_bstr_t(csFileName)); If we change to UNICODE (from MBCS) or to a Statically linked MFC (from a dynamically linked MFC) things start to work again. This problem only occurs in release mode (with MBCS &...

Sony NSCGC1 Net-Sharing 5MP CMOS MPEG4 Camcorder
Price:$109.99 Image: http:///image.php?id=B000SXZI2Y Best deal: http:///index.php?id=B000SXZI2Y I don't like sony item any ways. I wish that the person who got this for us. Got it where will live so that we could return it. It does not take good video at all. You can not see the picture good at all too. Now I don't know what to do with it. I would not recommended this to any one at all. the shipping was too late. the camera works nice, but I think that to use this as a cam is not possible. i got this camera a year ago and its still working to this day i use it almost everyday.....

How do I set up outlook to work. I am now using comcast cable.
I am getting an eror message Eddie wrote: > I am getting an eror message Please post the error message IN FULL. Thank you. That doesn't sound good. If only we knew what that error message could be... "Eddie" <Eddie@discussions.microsoft.com> wrote in message news:C12D154C-3C64-49C9-A224-16D5A75B4083@microsoft.com... >I am getting an eror message IE>comcast.net>help> setup e-mail account "Eddie" <Eddie@discussions.microsoft.com> wrote in message news:C12D154C-3C64-49C9-A224-16D5A75B4083@microsoft.com... >I am getting an eror ...

Using INDIRECT within functions
I learned a bit from JLathman in a previous post but tried to use the same methodology with this formula (also learned from this Group to get the last entered value in a column) without much luck. The original formula was this with 2009 sheet being static: =LOOKUP(2,1/('2009'!H3:H65536<>""),'2009'!H3:H65536) Trying to make it dynamic I tried the following without success: =LOOKUP(INDIRECT("2,1/(" & O1 & "!$H$3:$H$65536<>"")," & O1 & "!$H$3:$H$65536)")) Did I miss something or are...

Change my Inbox messages from comcast.net to Microsoft Outlook
I would like to use Outlook to send/receive all my correspondence. Right now I have to use comcast.net. How do I change this? does Comcast support pop3 and SMTP? if so, they should have a how to page for configuring accounts in it or Outlook Express - the steps are similar but the dialogs will be different. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Soluti...

vb .net, registry, HKLM\System\CurrentControlSet, Security
Hello I'm writing a small program un vb.net 2005, and i need a read access to the keys of HKLM\System\ControlSet\Enum. It's working under Windows2000 and probably XP, but not with Vista and Seven, where the securities are stronger. It must work for regular users Here the piece of code, and i have a security violation Dim regPermission As RegistryPermission regPermission = New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum") regPermission.SetPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACH...

Need Help for Parent Child Table Join Output
Hi frnds I want to know whether following thing is possible through query Parent Table ---------------- Pid | PField1 | PField2 | PField3 | PField4 1 A Aa Aaa Aaaa 2 B Bb Bbb Bbbb Child Table ---------------- CPid | CField1 | CField2 | CField3 1 X Xx Xxx 1 X1 X1x X1xx 1 X2 X2x X2xx 2 Y Yy Yyy 2 Y1 Y1y Y1yy 2 Y2 Y2y Y2yy when we create a join between thi...

Excel worksheets in asp.net
I have a process to send data to Excel in a browser window from both a server control and via dataset code. I would like to create multiple worksheets (tabs in lower part of Excel spreadsheet) in one xls file. Is that possible? Below is a sample of code I am using to dump to Excel. Thanks. Sub ExportDataSetToExcel(ByVal Source As Object, ByVal E As EventArgs) strExcelSQL = "mc_selPeopleSearchHomeExcel" Response.Clear() Response.ContentType = "application/vnd.excel" Response.Charset = "us-ascii" Response...

How to use ampersand in footers like CS&S
I am defining my project plan and I have to place proprietary footers on the document. When I use the ampersand in the footer it displays the time and not the acronym for my company such as CS&S. It will show CS&[Time] and then display the time on my printouts. If I use a double ampersand it does the same thing. How can I use the ampersand as needed in my company Acronym CS&S? You could always paste the company logo as a graphic into the footer? Maybe use it as a field somewhere and add the field to your footer. "Sue" wrote: > I am defining my ...