This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes how to create aspx tag with xslt ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to create aspx tag with xslt ??" Watch "how to create aspx tag with xslt ??" New topic
Author

how to create aspx tag with xslt ??

Kero Gu
Greenhorn

Joined: Jul 30, 2002
Posts: 15
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
You'll have to show us what the source XML document looks like...
Otherwise we'll answer something like


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kero Gu
Greenhorn

Joined: Jul 30, 2002
Posts: 15
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

Joined: Jul 30, 2002
Posts: 15
I found another strange question that XSLT function unparsed-entity-uri() is not supported. How strange!!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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

Joined: Jul 30, 2002
Posts: 15
"&lt;" is shown as "&lt;" instead of <.
What I need is <.
[ April 01, 2004: Message edited by: Kero Gu ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Oh, sorry. Try encapsulating the "<% ... %>" into a CDATA block.
Kero Gu
Greenhorn

Joined: Jul 30, 2002
Posts: 15
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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

Joined: Jul 30, 2002
Posts: 15
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??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to create aspx tag with xslt ??