XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Aiman AshrafSubject: ASP.NET XSL custom control
Author: Aiman Ashraf
Date: 14 Sep 2005 03:45 PM
Hi to all,

It's possible to throw ASP.NET controls on to a page using XSL but is it possible to throw a .NET custom control on to a page using XSL?

This is the error I get:
Unknown server tag sec:MyCheckBox

Any help would be really appreciated

Thanks,
supernewbie

Postnext
Ivan PedruzziSubject: ASP.NET XSL custom control
Author: Ivan Pedruzzi
Date: 15 Sep 2005 03:59 PM
Could you post the code fragment?

Ivan Pedruzzi
Stylus Studio Team

Postnext
Aiman AshrafSubject: ASP.NET XSL custom control
Author: Aiman Ashraf
Date: 15 Sep 2005 04:33 PM
This is the code (VB). The error is thrown at oCtl = Page.ParseControl(strOutput). The error is Unknown server tag 'sec:CheckBox'

Try
Dim xslTransform As New Xsl.XslTransform
Dim sw As New System.IO.StringWriter
Dim oCtl As Control
Dim xmlDocMain As New System.Xml.XmlDocument

xmlDocMain.Load("C:\VSSWorking\Source\EQWebApplication\MemosXMLXSL\Memos.xml")
Dim navigator As XPath.XPathNavigator = xmlDocMain.CreateNavigator()

navigator = xmlDocMain.CreateNavigator()
xslTransform.Load("C:\VSSWorking\Source\EQWebApplication\MemosXMLXSL\OICDeclined.xsl")
xslTransform.Transform(navigator, Nothing, sw, Nothing)

strOutput = sw.ToString
'remove the dummy namespace attribute
If Not strOutput = "" Then
' strOutput = strOutput.Replace("xmlns:asp=""remove""", "")
strOutput = strOutput.Replace("xmlns:sec=""remove""", "")
End If
oCtl = Page.ParseControl(strOutput)
phdExtraInfo.Controls.Clear()
phdExtraInfo.Controls.Add(oCtl)
Finally
End Try

And the xsl looks like:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sec="remove">
<xsl:template match="/">

<TABLE id="ExtraInfoTable" style="Z-INDEX: 103; LEFT: 1px; WIDTH: 100%; POSITION: relative; TOP: 1px; HEIGHT: 1px" cellSpacing="0" cellPadding="0" border="0">
<xsl:for-each select="Memos/ODN/Security">
<tr>
<TD width="25%"><xsl:value-of select="Name"/></TD>
<td width="75%">
<sec:CheckBox id="{controlID}" style="POSITION: relative" runat="server" Width="128px" Height="32px" Text="SecurityControl"></sec:CheckBox>
</td>
</tr>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>

PS: This method works great when throwing asp controls.

Thanks
Aiman Ashraf

Postnext
(Deleted User) Subject: ASP.NET XSL custom control
Author: (Deleted User)
Date: 16 Sep 2005 02:57 AM
Hi Aiman,
why do you remove the xmlns:sec namespace declaration? That operation will make the XML invalid...

Alberto

Posttop
Aiman AshrafSubject: ASP.NET XSL custom control
Author: Aiman Ashraf
Date: 16 Sep 2005 07:28 AM
Hi,

Well, the remove xmlns:sec is done from the output string of the XSL transform method (which is html)...so that's not a problem....

Anyway, I found the solution. Though this is related more to .NET than XSL but anyway here goes:

We just have to prepend the following string to the output of the transform method:
Dim result As String = "<%@ Register TagPrefix=""sec"" Namespace=""MyNamespace"" Assembly=""MyAssembly"" %>"

Basically, this tells the page where to find the tag and the corresponding control.

Regards,
Aiman

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.