Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create aspx tag with xslt ??

 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to transform an xml file to aspx format with xslt.
How can I create <%@ Page language="vb" %> in xslt??
Thanks a lot.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to show us what the source XML document looks like...
Otherwise we'll answer something like
 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. Thanks a lot.The source XML file goes like this.
<?xml version="1.0" encoding="UTF-8"?>
<form id="FormFormEditor" name="FormFormEditor">
<form-define printsize="A4" layout="vartical" backcolor="white"></form-define>
<components count="3">
<component id="Image_1" type="Image" resource-id="">
<common name="Image_1" top="260" left="20" backcolor="LightGray" font="Arial" fontsize="10.5" width="101" height="49" />
<variable name="src" value="http://msdn.microsoft.com/library/toolbar/3.0/images/banners/msdn_masthead_ltr.gif" />
<variable name="border" value="True" />
<variable name="borderwidth" value="0" />
<variable name="bordercolor" value="Black" />
</component>
<component id="ListBox_1" type="ListBox">
<common name="ListBox_1" top="140" left="90" backcolor="LightGray" font="Arial" fontsize="10.5" width="121" height="77" />
<variable name="selectedindex" value="0" />
<variable name="listdata" value="" />
<variable name="border" value="True" />
<variable name="borderwidth" value="0" />
<variable name="bordercolor" value="Black" />
</component>
<component id="TextBox_1" type="TextBox">
<common name="TextBox_1" top="70" left="40" backcolor="LightGray" font="Arial" fontsize="10.5" width="101" height="20" />
<variable name="text" value="" />
<variable name="maxlength" value="100" />
<variable name="border" value="True" />
<variable name="borderwidth" value="0" />
<variable name="bordercolor" value="Black" />
<variable name="text-align" value="Left" />
<variable name="ime" value="True" />
</component>
</components>
<resources>
<resource id="" name="">
binary-imagedata
</resource>
</resources>
</form>
The relationship goes like this.
The <form> node in XML corresponds to the <form> tag in aspx file. And the <component> node in XML will be transformed to control tag according to its type[/] attribute. The attributes of <common> node and the <variable> node list describe the attributes of control tag in aspx. The <resources> node is an accessory of image control.
I have tried the way you told me by inserting [i]<%@ Page Language="vb" %>
directly in XSLT. But Microsoft Visual Studio .Net threw an exception saying XSLT cannot be started with %.
Then I tried to use DTD to define an entity whose content is just <%@ Page Language="vb" %>. But it also threw an exception.
Now, can you help me??
 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found another strange question that XSLT function unparsed-entity-uri() is not supported. How strange!!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. If your only problem so far is that the stylesheet doesn't compile complaining about the "<%" part, just encode it with "&lt;%" or "&lt;&#37;"
 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"&lt;" is shown as "&lt;" instead of <.
What I need is <.
[ April 01, 2004: Message edited by: Kero Gu ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, sorry. Try encapsulating the "<% ... %>" into a CDATA block.
 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean using DTD ??
If so, I found it unlucky that XSLT function unparsed-entity-uri() is not suppported.

[ April 01, 2004: Message edited by: Kero Gu ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kero Gu:
You mean using DTD ??
I mean like

In this context the CDATA block can encapsulate syntax that would otherwise make the XML malformed (like using "<" and ">").
 
Kero Gu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's so unlucky that it still transform < into &lt;.
I use MS Visual Studio .Net 2003. My OS is Win2k Proffessional version with SP3.
What shall I do??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic