473,508 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with XSLTransform Class in .NET

Hi,

Following template matches correctly in MSXML4 but NOT with .Net XSL
translator:

<xsl:template
match="//input[@value='go'][preceding-sibling::a[position()=1][contains(img/@src,'cancel')]]">

<--Do Some operation>
</xsl:template>

Code I wrote to translate the XML:
// Create an XPathNavigator to use for the transform.
XPathDocument mydata = new XPathDocument(xmlfile);
XPathNavigator nav = mydata.CreateNavigator();

// Transform the file.
XslTransform xslt = new XslTransform();
xslt.Load(xslfile);
XmlTextWriter writer = new XmlTextWriter(outputfile, null);

xslt.Transform(mydata,null,writer,null);
writer.Close();

I'm unable to figure out the problem. If anyone knows the solution, do let
me know.
I have also attached the input XML and XSL.

Thanks,
Animesh

Input XML:

<?xml version="1.0"?>
<html><body>
<table><tbody><tr><td>
<a href="http://www.hotmail.com" onmouseover="" onmouseout="">
<img src="http://myprod.concureworkplace.com/ewp/Images/entrycancel.gif"
alt="Cancel" border="0" title="Cancel"/></a>
<input type="submit" name="onclick" value="go"/>
</td></tr></tbody></table></body></html>

Input XSl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" method="xml"/>

<xsl:template match="//a[img[contains(@src,'cancel')]]" priority="1"/>
<xsl:template
match="input[@value='go'][preceding-sibling::a[position()=1][contains(img/@src,'cancel')]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="type">Submit</xsl:attribute>
<xsl:attribute name="value">Cancel</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="*|text()|@*">
<xsl:copy>
<xsl:apply-templates select="*|text()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

Jul 21 '05 #1
1 1373

"Animesh Sharma" <Animesh Sh****@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
Hi,

Following template matches correctly in MSXML4 but NOT with .Net XSL
translator:


You may want to post this to microsoft.public.dotnet.xml instead, thats
where all the XML wonks hang out.
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2956
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
2
6012
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
3
2258
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
8
607
by: Demon News | last post by:
I'm trying to do a transform (Using XmlTransform class in c#) and in the Transform I'm specifying the the output xsl below: <xsl:output method="xml" encoding="UTF-8" indent="no"/> the...
7
2828
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
1
1189
by: avnrao | last post by:
Hi, sorry if this is cross post.. I have a simple XSLTransformation which I am trying to load it in XSLTransform class as indicated below loading xsl : XslTransform tran = new...
1
2774
by: manlio | last post by:
how can I load a XSL string (not an xsl file!!) with XslTransform ??? If I use the code: // Create a new XslTransform class and load the stylesheet XslTransform myXslTransform = new...
1
3893
by: Lasse Edsvik | last post by:
Hello I was trying to do this example shown here: ...
0
1196
by: Matt | last post by:
With VS2005 I see that the XslTransform class has been deprecated and XslCompiledTransform has replaced it. I am having issues with trying to get the new class to work how it did with the old. I...
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.