The key isn't to do this in the XSLT document, but rather the ASP.NET page.
<script runat="server">
Public MenuList As String = String.Empty
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim ds As New DataSet()
ds.ReadXml(Server.MapPath("~/Web.sitemap"))
' this for-each block resolves client URL
For Each dr As DataRow In ds.Tables(0).Rows
Dim tempURL As String = Page.ResolveClientUrl(dr("url").ToString)
dr("url") = tempURL
Next
Dim strXML As String = ds.GetXml()
MenuList = GetHtml(Server.MapPath("~/sitemap_static_3.xslt"), strXML)
End Sub
Public Shared Function GetHtml(xsltPath As String, xml As String) As String
Dim stream As New MemoryStream(ASCIIEncoding.[Default].GetBytes(xml))
Dim document As New XPathDocument(stream)
Dim writer As New StringWriter()
Dim transform As New XslCompiledTransform()
transform.Load(xsltPath)
transform.Transform(document, Nothing, writer)
Return writer.ToString()
End Function
</script>
Member
16 Points
155 Posts
xslt: how can I fine-tune the href attribute of an anchor tag?
May 03, 2015 11:58 PM|HatesSunlight|LINK
I have a successful XSLT file (shown below), but what I'd like to do is adjust
so that when when the transformed xml file appears in my asp:xml control on my aspx page, it appears as:
I figured this wouldn't work, but this is the result I need. Is there some way to do this right?
Here is the full xslt script, with the relevant line bolded:
Thanks for any ideas.
xslt href url
Member
16 Points
155 Posts
Re: xslt: how can I fine-tune the href attribute of an anchor tag?
May 04, 2015 01:10 PM|HatesSunlight|LINK
The key isn't to do this in the XSLT document, but rather the ASP.NET page.
In the body:
xslt href url