Is a XML file Does not Support XSL and XSD operation together.

Dear Experts,

Check out the following XML, XSl and XSD document. 

If i use XML file without XSD defination it applies XSL style and If i 
include the XSD document. Nothing is getting displayed in the browser.  
Is that mean XSL and XSD can not be apply together on a XML file. ? or I am 
doing something wrong ?

Thanks
Samir


--- ---- XML Document  ---------
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="ch_5_NewsPaper_Style_1.xsl"?> 
<!-- <NEWSPAPERDATA xmlns="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd"> -->
<NEWSPAPERDATA>
  <NEWSPAPERINFO>
    <PAGEDATA>
      <PAGEHEADER>M TIMES</PAGEHEADER>
      <PAGENO>1</PAGENO>
      <PAGETYPE>MAIN</PAGETYPE>
      <PAGEDATE>2007-07-23T00:00:00.0000000+05:30</PAGEDATE>
    </PAGEDATA>
  </NEWSPAPERINFO>
</NEWSPAPERDATA>

-------- XSL Document

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:for-each select="NEWSPAPERDATA/NEWSPAPERINFO/PAGEDATA">
<xsl:text>Page Header : </xsl:text>
	<font color="blue" >
	<xsl:value-of select="PAGEHEADER"/>
	</font>

	<xsl:text> Page No : </xsl:text>
	<font color="orange" >
		<xsl:value-of select="PAGENO"/>
		</font>
		<xsl:text> Page Type : </xsl:text>
	<xsl:value-of select="PAGETYPE"/>
	<xsl:text> Page Date : </xsl:text>
	<xsl:value-of select="PAGEDATE"/>
</xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

  

---------XSD Document ------

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ch_5_NewsPaper_Style_1" 
targetNamespace="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd"
	elementFormDefault="qualified" 
xmlns="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd" 
xmlns:mstns="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd"
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="NEWSPAPERDATA" type="npdata"></xs:element>
	<xs:complexType name="npdata">
		<xs:sequence>
			<xs:element name="NEWSPAPERINFO" type="npinfo" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="npinfo">
		<xs:sequence>
			<xs:element name="PAGEDATA" type="pdata" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="pdata">
		<xs:sequence>
			<xs:element name="PAGEHEADER" type="xs:string" />
			<xs:element name="PAGENO" type="xs:positiveInteger" />
			<xs:element name="PAGETYPE" type="xs:string" />
			<xs:element name="PAGEDATE" type="xs:dateTime" />
		</xs:sequence>
	</xs:complexType>
</xs:schema>


0
Samir1014 (3)
8/4/2007 7:40:00 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
541 Views

Similar Articles

[PageSpeed] 8

Samir1014 wrote:

> Check out the following XML, XSl and XSD document. 
> 
> If i use XML file without XSD defination it applies XSL style and If i 
> include the XSD document. Nothing is getting displayed in the browser.  
> Is that mean XSL and XSD can not be apply together on a XML file. ? or I am 
> doing something wrong ?

It is the same problem as usual with

> <!-- <NEWSPAPERDATA xmlns="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd"> -->

such a default namespace declaration. To match/select such elements with 
  XPath 1.0 you need to bind a prefix to the namespace URI and use that 
prefix in the stylesheet to qualify names. No change to the XML is 
needed but in your stylesheet you need

> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:np="http://tempuri.org/ch_5_NewsPaper_Style_1.xsd">

then use the prefix np to qualify element names e.g.

<xsl:for-each select="np:NEWSPAPERDATA/np:NEWSPAPERINFO/np:PAGEDATA">
<xsl:text>Page Header : </xsl:text>
	<font color="blue" >
	<xsl:value-of select="np:PAGEHEADER"/>
	</font>

and so on at all places where you want to select/match elements in that 
namespace.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
8/4/2007 11:51:55 AM
Reply:

Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

Illegal Operation #2
Everytime I send an email message, I get an illegal operation notice. This also happens when I delete emails. The following are examples of the details of the illegal operations. Does anyone know what I can do to correct this? OUTLOOK executed an invalid instruction in module <unknown> at 0000:00ff705e. Registers: EAX=00000000 CS=017f EIP=00ff705e EFLGS=00010297 EBX=00ff686c SS=0187 ESP=0056f1e0 EBP=0056f21c ECX=00ff686c DS=0187 ESI=0056f210 FS=22e7 EDX=00000000 ES=0187 EDI=00ff705c GS=0000 Bytes at CS:EIP: 8e 30 00 00 00 00 f4 68 ff 00 62 01 00 00 33 00 Stack dump: 00ff705c 00f...

how to compare two excel files
i would like to know how to compare two excel files. is there any tool for that? in addtion is there any way to maintain several versions of the same file with easy way to have diff between them? thanks, -- Miri Tz. Hi Miri, There are a number of programs out in the market that provide more complex comparision. Otherwise you could simply make a new sheet and copy the following formula into A1: =if('[book1.xls]sheet1'!a1='[book2.xls]sheet1'!a1,"","<<<") anotherway to do it is to run the following you need to set up the workbook and workshee...

Identify files on two diff spreadsheets
I need help... I have two spreadsheets, named 2008 and RS, both with file numbers in column A1 with different information in the other columns. I need to know if the files on the spreadsheet "RS" are on the spreadsheet "2008" and if so, then put a "1" in column "U" next to that file on the "2008" spreadsheet. I tried the vlookup function, but couldn't quite figure it out. Please help. Thanks in advance. Try this formula in column U of the 2008 sheet: =IF(COUNTIF(RS!A:A,'2008'!A1)>0,"U","") ...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

Sync mail files
I have a small network of 3 computers. Can I syncronize the Outlook.pst file so that any of the 3 machines will have access to all of the mail folders? Any clues will be welcomed. Gill gaffer <gaffergill@bellsouth.net> wrote: > I have a small network of 3 computers. Can I syncronize the > Outlook.pst file so that any of the 3 machines will have access to > all of the mail folders? See if something here helps: http://www.slipstick.com/outlook/sync.htm -- Brian Tillman ...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

Corrupted .pst file !!!?!?! Help
Hi, My outlook.pst is corrupted. Tha'ts why I cannot start me outlook 2003 (see my other post here) I used the inbox repair tool (SCANPST.EXE) but it doesn't work, I got the following message: "An unexpected error prevented access ti this file. Use scandisk to check the disk for errors and then try using the inbox repair tool again" Outlook is closed and I already scanned my hard disk using scandisk, and there are no error. The error really seems to come for the corrupted pst file. Related to the file corruption, When I tried to copy the outlook.pst file to an...

Installing Money 2003 on new PC..what files to copy from old PC?
I have purchased a new PC (Windows XP). To move Money 2003 to the new one, I assume that I would just install Money from the original CD. My question is, what files do I need to copy from my old PC? (old PC was Windows 98) Thanks, Tommy Flynn Your .MNY file(s). And you will need to move most of the Money Tools|Options settings by hand. Worst case for these is printer check alignment settings. "Tommy Flynn" <tflynn@mindspring.com> wrote in message news:bfbff0$fjf$1@slb9.atl.mindspring.net... > I have purchased a new PC (Windows XP). To move Money 2003 to the new one...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

File sharing
Hi, I have a client with two machines running Mac OS X 10.3.6, and MS Office 2004 with SR1, and both machines have file sharing enabled. If machine1 has a file on its hard disk opened called file1.xls, and machine2 tries to open the same file I thought that machine2 would only be able to access the file read-only, and be told this. However what I am seeing is that machine2 can open the file, make changes, and save the changes but if machine1 makes changes and saves their version machine2's changes are lost. Shouldn't machine2 be told that they can only open the file read-only? Thank...

Does MS CRM 3.0 support rss feeds? (Really Simple Syndication)
Does MS CRM 3.0 support rss feeds? If so how do you configure CRM for it? TIA Eric Microsoft has published a RSS connector for CRM that can be downloaded here: http://download.microsoft.com/download/3/2/1/32163234-b67e-491b-ae5a-8717f649baaa/CrmRssFeed.exe--Matt ParksMVP - Microsoft CRM"Eric Rist" <EricRist@discussions.microsoft.com> wrote in messagenews:2B601B4D-ACD3-497F-AFD9-391469D7297D@microsoft.com...Does MS CRM 3.0 support rss feeds?If so how do you configure CRM for it?TIAEric ...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

TMP files #3
Since getting a new pc, any attempt to save a file in Excel, instead saves to a TMP file. I get no errors, and I can open the file again fine, but my disks are slowly filling up with TMP file instead of spreadsheets. Any ideas? Jono Although you didn't get an error message this article describes problems with saving files and being left with tmp files. It may provide some insight: http://support.microsoft.com/default.aspx?scid=kb;en-us;103329&Product=xlw -- Jim Rech Excel MVP "jono" <anonymous@discussions.microsoft.com> wrote in message news:1d65401c423a1$29e...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

Outlook 2002/Exchange Server
We have started inserting HTML signatures into e-mails, instead of standard text signatures. The signature looks like a rolodex card with contact info and adds about 7KB. An image, which I assume is treated as embedded, is the border around the "card." The only other image is our logo, which is a direct link to a GIF on our website, not embedded. However, I have recently become aware of potential file size problems due to how Outlook handles e-mail attachments. We typically send e-mails with Word document attachments internally to multiple recipients. When they are done reviewi...

Log files #5
Here's the situation 1. Hard disk died (Single IDE) 2. Have a sucessful ntbackup on a remote server 3. Rebuilt Win Server 2000 with new disk using previous server name 4. Restored System State from ntbackup 5. Reinstall Exchange 2000 SP3 6. Restored Mailbox Store and Public Folder Store. 7. The default Mailbox Store and Public Folder Store would not mount. It would let me create and mount a new one, though. 8. Searched endless articles to find out why Mailbox Store fail to mount but no avail, so created a new Mailbox Store. 9. Deleted all users' Mailboxes ...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

RMS Store Operations Software Enhancements
Microsoft should look at implementing (borrowing) some of the great features of this integrated software package. The company Everest markets this product to the small/medium business market, but for $20-25k per license (non-transferable), and another $10+k to implement, it's not a viable "small business" solution (plus their on-support is totally based in India, very expensive and mediocre). Their newest version was just released today, and includes many features which MS could adopt to give RMS SO an edge. The following link offers all of the details: <http://w...

Quickly finding a record within a file
I have a file that contains 1,400 names and addresses. How do I find a name quickly without having to scroll the whole file? Hi 'Edit - Find' from the menu?? -- Regards Frank Kabel Frankfurt, Germany Janiebutt wrote: > I have a file that contains 1,400 names and addresses. How do I find > a name quickly without having to scroll the whole file? I like applying data|filter|autofilter Then do a filter using custom, contains, and type just a little of what's in the name. Janiebutt wrote: > > I have a file that contains 1,400 names and addresses. How do I find a...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

Can I restore a file that I have accidentally saved over?
Hi there, I was typing up a document and wanted to check how many words i had typed. Clicked the wrong button by mistake and auto selected the whole document. What made it worse was that my brother was next to me being a pain and saved the document, when I came back he panicked as it was all gone so he rebooted the computer. I have tried using windows restore to turn back time but the document remains as what my brother saved it as, "Z". What can i do? i need it back to normal asap HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!! ME!!!!! Was the document saved previously with...

Creating and Organization Chart from and excel file
I was able to create an org. chart awhile ago and now when I try to use the org. chart wizard and select the excel file I get an error "cannot read names". I have excel and visio 2003. Can anyone help???? I want to include 4 fields from from excel file (name, title, department, reports_to). Help! Have you tried creating an Excel file recently? Perhaps there's an issue with your existing Excel file. I'd try generating a dummy file using the wizard, and then try importing it iback nto a new Visio file using the wizard. If that works, then you may want to cut / pas...

windat files I have a nagging problem with attachments to my emails that have the the winmail.dat attachnents
I have a nagging problem with attachments to my emails that have the ..winmail.dat format. my hotmail email will not open these attachments. I have to save the attachment to my desktop and then use a windat reader to open the file,which takes so much time. isn't there any other way to open these attachments? thankyou. -- Richard K Mahan Sr "Imagination is the Father of Creativity" -- Richard K Mahan Sr "Imagination is the Father of Creativity" "Richard Mahan" <dmachen35@comcast.net> wrote in news:QYidnQUtfOjpTVvbnZ2dnUVZ_q6hn...