473,804 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLTransform.Tr ansform() doesn't work!

Hello,

I am using translate in my .xslt to remove the space like this:

<xsl:for-each select=".//Illustration">
<xsl:value-of select="transla te(./@illusName, ' ', '')"/>

But this doesn't seem to work when i use the Transform() of .NET. The above
works well with command line msxsl and XMLSpy.

I also tried the following workarounds, but it still doesn't work:
<xsl:element name="{translat e(@value1, ' ', '')}">
<xsl:value-of select="transla te( (./@illusName, ' ', '')"/>

Is this a known problem with .NET. Plz help!
Feb 23 '07 #1
3 1415
Well, from what I can see it shouldn't work in the others... first:
you have an odd number of brackets in the second line; second:
translate converts characters from the first array into the
corresponding (by index) from the second, e.g. (from w3schools):

<quote>Exampl e: translate('12:3 0','30','45')
Result: '12:45'

Example: translate('12:3 0','03','54')
Result: '12:45'

Example: translate('12:3 0','0123','abcd ')
Result: 'bc:da'</quote>

It is *not* the same as "replace"; look at the "replace" function...

Also : ".//element" and "./@attrib" are usually just "//element" and
"@attrib"

Marc

Feb 23 '07 #2
(ignore my "number of brackets" remark; the *entire* workaround
example (OP) is just plain wrong; don't use any of this "workaround ")

Feb 23 '07 #3
The translate function takes 3 strings as arguments. you are passing a node
or attribute into it. Use the string() function to transform the node or
attribute to a string.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"Gaurav" <Ga****@discuss ions.microsoft. comwrote in message
news:7D******** *************** ***********@mic rosoft.com...
Hello,

I am using translate in my .xslt to remove the space like this:

<xsl:for-each select=".//Illustration">
<xsl:value-of select="transla te(./@illusName, ' ', '')"/>

But this doesn't seem to work when i use the Transform() of .NET. The
above
works well with command line msxsl and XMLSpy.

I also tried the following workarounds, but it still doesn't work:
<xsl:element name="{translat e(@value1, ' ', '')}">
<xsl:value-of select="transla te( (./@illusName, ' ', '')"/>

Is this a known problem with .NET. Plz help!

Feb 23 '07 #4

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

Similar topics

5
1845
by: Kevin Westhead | last post by:
I'm using XslTransform to apply a transform to an XML document, however I get validation problems when parsing the resulting XML document due to invalid whitespace. I'm passing in an XPathNavigator for the input to the Transform method and specifying a Stream for the output. Here is an example of a transform and a document (it's the IconStyle sections that are causing problems): <?xml version="1.0" encoding="UTF-16"?> <!-- Copyright...
2
6045
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 XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
6
2409
by: BLechmann | last post by:
Hello *, I'm trying to transform my DocBook document with the FO stylesheet from the DocBook XSL distribution (the transformation with the XHTML stylesheet works). I changed "$years + 1" to "number($years) + 1" two times in common.xsl. But the transformation doesn't work anyway. The funny thing is, that if I use the msxsl command line utility there is no problem. But when I use nxslt (or my own code) then I get the
3
2271
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 use this so that we can specify different templates to be used by the same xml node. Know that we could use global params, but would rather not have to update all teh stylesheets and any code that uses msxml and the same stylesheets.
4
3596
by: David S. Alexander | last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node of my XML is not being matched by the XSLT if it has an xmlns attribute. Am I handling my namespaces incorrectly? My C# code is, // Create an XSLT transform object XslTransform xslTransform = new XslTransform(); // Load the stylesheet
1
1516
by: rmgalante | last post by:
Hello, I have a VB.Net component that uses the XslTransform object. I am using the FXSL randomizeList function in my XSL template. When I transform the XML in the VB.Net component, my application hangs. When I load the XML in a browser with a reference to the XSL template, it works fine. Here is my XML:
12
10124
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b) ..... // xsl contents abc.aspx?p1=v1&amp;p2=<xsl:value-of select="$v2" />
9
2507
by: WT | last post by:
Hello, I have code created with .net 1.0 and migrated to 3.5. Form 2.0 the XslTransform class is obsolete and the vs2008 compiler generates warnings that these classes are absolete suggesting to use XslCompiledTransform. But all this was rendered using an Xml control and I can't find a way to relate this control to an XslCompiledTransform ? Any help appreciated to solve this migration pb.
0
1244
by: bryhi | last post by:
Here is the code you can past in your console application to see the differences. I need to know how to get this to work correctly. #pragma warning disable // because we are using a depricated object static void Main(string args) { /* * There are two problems: * 1. The characters (CRLF) are not being output by the new object. * 2. Anything not in xml tags causes a crlf to be inserted. */
1
1078
by: sudhaMurugesan | last post by:
Hi all, I am using VS2003. I am new to VS2003. I cannot transform an xml file into a string output in my windows application. But the same function works well with VS2005. it also asks for xmlresolver in the transform() function. I provided Nothing as 4th parameter, eventhough it doesnt work. anybody can help me?. I dont know where i am wrong. I need to create html files with this xml data. Public Shared Function CreateHtmlFile(ByVal...
0
9712
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7634
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.