|
<?xml version="1.0" encoding="UTF-8"?>
<code>
<pubs>
<pub>
<firstins>2006-12-08</firstins>
<lastins>2006-12-10</lastins>
</pub>
</pubs>
<pubs>
<pub>
<firstins>2004-12-08</firstins>
<lastins>2006-01-17</lastins>
</pub>
</pubs>
<pubs>
<pub>
<firstins>2007-12-08</firstins>
<lastins>2007-12-09</lastins>
</pub>
</pubs>
</code>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="html" doctype-public="'-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'"/>
<xsl:template match="/">
<html>
<head>
<title>String Comparison</title>
</head>
<body>
<xsl:apply-templates select="code/pubs/pub[ms:string-compare(firstins, lastins) = -1]"/>
</body>
</html>
</xsl:template>
<xsl:template match="pub">
<p>
<xsl:value-of select="firstins"/> is less then <xsl:value-of select="lastins"/>
</p>
</xsl:template>
</xsl:stylesheet>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
If <Object> is your document node (topmost node) then your XPath should be: xxPath = "/Object[@name='" & LCase(menu11.Name) & "']"
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
thanks
i found what was the problem.
|
|
|
|
|
I grabbed the following .xml and .xsd files from an online tutorial, and tried to import them into SQL Server by using XML Source. I want to be able to import ALL the data; however, the simpleType elements under the root <shiporder> are all missing from the XML source, e.g <orderpersion>. The root element, including any attributes from the root element are also missing...e.g <shiporder orderid="889923"
How can I import these missing fields? The .xml and .xsd files are below.
Any help will be greatly appreciated. Thanks.
.XML and .XSD files below.
shiporder.xml
----------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
----------------
shiporder.xsd...
----------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="stringtype">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="inttype">
<xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>
<xs:simpleType name="dectype">
<xs:restriction base="xs:decimal"/>
</xs:simpleType>
<xs:simpleType name="orderidtype">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{6}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="shiptotype">
<xs:sequence>
<xs:element name="name" type="stringtype"/>
<xs:element name="address" type="stringtype"/>
<xs:element name="city" type="stringtype"/>
<xs:element name="country" type="stringtype"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="itemtype">
<xs:sequence>
<xs:element name="title" type="stringtype"/>
<xs:element name="note" type="stringtype" minOccurs="0"/>
<xs:element name="quantity" type="inttype"/>
<xs:element name="price" type="dectype"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="shipordertype">
<xs:sequence>
<xs:element name="orderperson" type="stringtype"/>
<xs:element name="shipto" type="shiptotype"/>
<xs:element name="item" maxOccurs="unbounded" type="itemtype"/>
</xs:sequence>
<xs:attribute name="orderid" type="orderidtype" use="required"/>
</xs:complexType>
<xs:element name="shiporder" type="shipordertype"/>
</xs:schema>
|
|
|
|
|
Hi!
i am storing the user defined URL in XML file by using C#. I am storing that URL inside the tag as InnerText.
if i store the URL "http://www.google.com" it works perfectly, but when i try to store the URL "http://www.google.com/search?hl=en&q=abc" it corrupts the XML file and gives error "A semi colon character was expected."
can anybody tell me what is the reason behind this error...?
Thanks,
Regards,
Affan Ahmad Toor
|
|
|
|
|
Hi
I am quiet sure that the & is the error because it is a special sign in XML. If it also doesn´t work than i might suggest the ?.
Thats the two possabilities.
Hope i helped.
|
|
|
|
|
Thanks for reply,
i checked the & sign as you suggested. You was rite, the error was because of the & sign.
Looking forward for more help from you in future...
Thanks again...
Regards,
Affan Ahmad Toor
|
|
|
|
|
|
You can overcome this prob by writing & I think. Just if you don´t have a solution.
|
|
|
|
|
You mean by writing: &
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
sure
sorry
|
|
|
|
|
replace & sign with amp;
rupesh
|
|
|
|
|
Hi,
I need to export my product table to an XML file. All the products need to be in the XML file. I have never worked with XML, except when using the web.config file.
Can someone maybe give me an indication of what the structure of such a file might look like, and how do I export it? If anyone has any good links that I can read, please let me know. The file must be later be imported back into the products table.
Regards
ma se
|
|
|
|
|
You need to know more about XML. The following may be a good start: http://www.w3schools.com/xml/default.asp[^]. Also, you have given very little information about your issue. Since, you didn't give any information about your Table schema, the database or the programming language you are using, you are not going to get much help.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
How can i generate an xml file using javascript
|
|
|
|
|
|
Hi All,
Is there any open source tool like Castor(for java) to convert XML/Schema to C# classes in .NET other than xsd.exe?
Thanks in Advance.
Gokulan
|
|
|
|
|
hay!
I was wondering if I can use a methode in Xslt. I'm using 3 times the same display logic and I don't like that
The 3 times:
1) I have to display a table (while headers) so for my first node I display the data in the nodes + the node attribute (the column name)
2) When I have One row I display the whole thing verticaly so I the same logic in another display logic
3) finally, when I have to display the rest of the rows (more then one) then they are just added tho the horizontal display (point 1 above)
3times the same logic... Can I do something about that? A methode?
thx!!
|
|
|
|
|
The structure of your XML will make transforming it into a table easy or hard. However, you can structure your XSLT to increase the number of columns or rows dynamically by using templates and recursion rather than by looping using for-each. If you want to use functions (methods), parse it in C#, VB.NET, C++/CLI, C++, C or Java.
By the way, I cannot help you much since you didn't give me any clues about the code you written or about the XML you are trying to parse.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Use <XSL:for-each>...</xsl:for-each>
Please refer this[^] for more information.
Regards,
Paresh.
|
|
|
|
|
I have a set i want to enumerate through in an XSLT, of say, 3-4 values, and i'd like to comma seperate them except for the final one.
i.e. i'd like
new string[] {"John", "Ben", "Suzy"};
to be generated in the xslt into:
"John, Ben, Suzy"
Without the trailing comma after suzy, but i have no idea how to do this.
Could anyone help?
Cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Try usin an if with something like not(last())
led mike
|
|
|
|
|
Fantastic,
Cheers.
Forgive me, i'm an Xslt noob using copy and paste
T
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Buy a book. (Dang that sounds nastier than I want, I really mean it as a friendly suggestion.)
When I started learning XSL I found my old XML Bible (circa 2001) was out of date, so I bought a new book; XSLT 1.0, O'Reilly and it really helped.
And also http://www.w3schools.com/xsl/default.asp[^]
|
|
|
|
|
I find it easy enough to grasp, and i can figure it out in time. I just hate the whole process of doing tutorials and stuff that i already know just to get to those small gems of information that i actualy need to make it work.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|