|
I'm building an application, using C# and SQL 2000, where based on the user identity I wish to present different views of data and XSLT is an ideal solution for this application. If when I call the Load method of XslTransform I reference an on-disk file everything works as expected.
XslTransform transform = new XslTransform ();
transform.Load (@"D:\WorkDir\test.xslt");
However, I want to store different XSLT's in the database and retrieve it based upon the user's identity. (Interesting enough I could find no sample code anywhere that did this, although I would think it would be fairly common).
When I try to read back the XSLT from SQL - if I do not put in a FOR XML I cannot load the result into an XmlReader class. I get an exception of:
"Invalid command sent to ExecuteXmlReader. The command must return an Xml result."
Putting in a FOR XML AUTO or RAW allows it to load the reader, but the transform.Load subsequently fails with:
"Missing mandatory attribute 'version'."
although there is a version tag in my XSLT.
sqlConn.Open ();
SqlCommand sqlCommandXSL = new SqlCommand ("sp_GetUserTransform 0", sqlConn);
XmlTextReader xmlReadTransform = (XmlTextReader) sqlCommandXSL.ExecuteXmlReader ();
XPathDocument doc = new XPathDocument(xmlReadTransform, XmlSpace.Preserve);
XPathNavigator xpn = doc.CreateNavigator ();
XslTransform xslTransform = new XslTransform ();
xslTransform.Load (xpn, null, null); <-- throws exception here.
I'd appreciate any insights as to what I'm doing incorrectly and links to samples that show how to do this.
Thanks.
|
|
|
|
|
I am using the classes and methods from the Msxml2.DOMDocument.4.0 namespace to dynamically create an XML file using VBScript. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xml_mth_sz_3jol.asp). I was able to successfully create the XML and load it into memory for parsing. However, for some reason, I am not able to use the SelectSingleNode() method of the IXMLDOMNode object. The error I get is: "Object doesnt support this property or method. Error code: 800A01B6".
Any ideas?
|
|
|
|
|
hi
I try to send data as xml bitween client/server
help me i don`t need to enconing it byte`s
thank you
|
|
|
|
|
Erm, what language / platform / protocol are you using?
Ryan
|
|
|
|
|
1- thank you
2- language c# ,platform 2003 server ,protocol ip
hmd.....
|
|
|
|
|
Do someone no how to open/load an empty file in IXMLDOM? I want to export data from a program to a xml-file. To do so I have to open a empty file and then start creating Elements ant attributes and stuff. Anyone who could help me...please, I'm stucked
|
|
|
|
|
im a college student, being asked to implement an xml signature.
i have a very basic knowledge on xml signature.
theoretically,i understood that one of its method involves SHA and DSA.
but practically, how do i use those SHA and DSA?
what platform and software do i need?
can anyone suggest a very basic and simple one so i can generate and verify xml signature.
akima
|
|
|
|
|
|
I'm working on an App that will transfer info via XML to Microsoft project 2002.
How can I find info about the XML-file I should create?
...and justice for all
APe
|
|
|
|
|
Hi Friends
I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by version 2 of XSLT processor based on some condition.
Q) How and where shall I write logic or import desirable XSLT on the Fly ?
Q) When we call AAA.XSLT then it will be processed by XSLT Processor 1 and when we call BBB.XSLT,it will be called by XSLT processor 2. (This is what I want to happen). Is this statement correct? Is it possible?
---Main.XSLT-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This functionality is not supported. -->
<xsl:choose>
<xsl:when test = "X = AAA">
<xsl:include href=".\AAA.xslt"/>
</xsl:when>
<xsl:when test = "X = BBB">
<xsl:include href=".\BBB.xslt"/>
</xsl:when>
</xsl:choose>
</xsl:stylesheet>
----------------
---AAA.XSLT----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!----some code here for version 1 of xslt---->
</xsl:template>
</xsl:stylesheet>
---BBB.XSLT-----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!------some code here for version 2 of xslt---->
</xsl:template>
</xsl:stylesheet>
Thanks
Mohit
mohitfl@hotmail.com
|
|
|
|
|
I am sorry for My English is poor
i want to ask that
i have a .XSD file which have an complexType
the complexType have some element
can i use fill method to fill these element
study everyday
|
|
|
|
|
I am a student and i got assignment to do which is the title is
"An XML browser-based electronic medical record"
So, anyone can help me to this project?
I really-really need any help from others because i don't know how to do it.
Any question just email me at: alyssahaskell@yahoo.com
Thank you
|
|
|
|
|
Hi, i think you just have to document contacts physician-patient in med. terms. Well, an then do some XSL-Transofrmation into HTML to view the content?
some med. standards (for google): HL7 , CDA, ICD, sciphox, ..
I mean/suggest some xml like:
<?xml version="1.0"?>
<record xmlns:myns="my/medrecord">
<head>
<patient id="2534">
<name> .. </name>
<insurence> .. </insurance>
</patient>
</head>
<body>
<contact date="2004-01-30" med="Dr. Mabuse">
<anamnesis>
problems with stomach, often tired
</anamnesis>
<finding>
high bloosugar values,low bloodpressure
</finding>
<diagnoses icd10="B20.4"> <!-- International Code of diseases -->
diabetes mellitus typ II
<diagnoses>
<prescription>
antisugar 100 mg N1
</prescription>
</contact>
<contact date="2004-02-04" med="Dr. Mabuse">
<laboratory>
<value name="LEUK" unit="count">263</value>
<value name="BIL" unit="mg/dl">23.4</value>
</laboratory>
...
</contact>
...
</body>
</record>
good luck!
|
|
|
|
|
Please
can some one tell me whats Inner XML and Outer XML
Every is Illusion
|
|
|
|
|
OuterXML refers to the xml representation of the current node and its contents. InnerXML refers to the xml representation of the contents of the current node only, and not the current node itself.
|
|
|
|
|
Hi
Can anyone tell me where can I find interview questions related to above technology?
TIA
|
|
|
|
|
So i got a XML outputing tool for my database engine but a colegue of mine wants series of SQL's INSERTs so he can easyly insert them into his database. since there will be different tables with different structure i wander if a transofrmation could be done. I'm very new in XSLT and all the tutorials I've been looking are tailored to specific DTD which is not the case here. All I want to know is there a way this problem to be solved via XSLT, or i will need to expand the XML outputing tool...
Thanks in advance
SDR
|
|
|
|
|
Hi,
I am using xml as data source for a simple project, but there will be lots of data in the XML file. I want to ask is there a maximum capacity for an XML file that was declared in anywhere. Or its is only about the parser performance to aware.
thanx.
karanba
|
|
|
|
|
There is no limit to the size of an XML file, except what is defined by your file system or other system limitations. However, large XML files can be very memory and processor intensive to handle.
As you say, it is all about how well the "parser" can handle big files. As a general rule in .NET, stream-based parsers will handle large XML files better than document-based parsers.
XML is especially weak when editing large files. I would not recommend it as an updateable data source unless you have very small amounts of data.
|
|
|
|
|
i am trying to display some data to the user as HTML. i have been told to convert the data into XML and to then use an XSL style sheet to convert the XML into HTML.
i have the situation:
<specimens>
<specimen_item>
<number>1</number>
</specimen_item>
<specimen_item>
<number>2</number>
<origin>left arm</origin>
</specimen_item>
<specimen_item>
<number>3</number>
</specimen_item>
</specimens>
i have worked out enough XSL to produce a style sheet that converts my XML into HTML.
the problem is that i want to turn this data into a table. the number tag goes into the Number column, and the origin value goes into the origin column.
the full table has 9 columns, but most of the time there is no data in most of the columns.
in the original C code i am manually generating the HTML from the original data. so i check to see if there is any data in the origin column, and if there is no data i do not build this column.
so i want an <xsl:if> block that only builds the cells for the origin column if string-length(.) > 0 for at least one of the origin tags in the XML.
i am using IE6 to evaluate the XSL stylesheet, and after 2 days i still cannot do this.
setting the current scope to the specimens block, i have tried various variations on:
<xsl:if test='string-length(specimen_item/origin) > 0'>
but this only seems to check the content of the first specimen_item block.
so far the only way i can see to get around this is to add extra tags to the XML that are used to control how the XSL builds the display. if i am going to have to go to this level, then i would rather simply generate the HTML by hand in my C++ code.
any helpful suggestions would be gratefully received.
|
|
|
|
|
you have to do two things...
1) you have to interate of each specimen_item, either by using a for each, or using apply-template. (I would use apply-templates)
2) your test would be better using an element test...
so something like:
<br />
<br />
<xsl:template match="/"><br />
<xsl:apply-templates select="specimens" /><br />
</xsl:template><br />
<br />
<xsl:template match="specimens"><br />
<table><br />
<tr><br />
<td>Number</td><br />
<td>Origin</td><br />
</tr><br />
<xsl:apply-templates select="specimen_item"/><br />
</table><br />
</xsl:template><br />
<br />
<xsl:template match="specimen_item"><br />
<tr><br />
<td><br />
<xsl:value-of select="number"/><br />
</td><br />
<xsl:if test="origin"><br />
<td><br />
<xsl:value-of select="origin"/><br />
</td><br />
</xsl:if><br />
</tr><br />
</xsl:template><br />
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
i actually did this with
<xsl:for-each select='specimen_item'>
i havent really got my head around templates yet. unfortunately the templates dont help with the real problem. i only want to create the Origin column if there is data to go into it.
so far i cannot see any way to do this in XSL without introducing a new "is there any Origin data at all" tag into the XML
|
|
|
|
|
> so far i cannot see any way to do this in XSL without introducing a new "is there any Origin data at all" tag into the XML
thats what the test I wrote does.... the test will work in either a template or a for-each.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
*puzzled expression*
i have only been doing XSL for a few days, so perhaps i am overlooking something. still, i think we are talking at cross purposes.
from reading this, and based on a couple of experiments this XSL always writes out the Origin table head item even if there is no data for this column. i am trying to remove the Origin column from the output HTML when there is no data, and i am not seeing this example do this.
|
|
|
|
|
ok understood.
just use the //origin (the // means are there any children called origin.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|