|
If they were the same I wouldnt be having this problem.
I dont no the reason why it is considered invalid, but it just is, and as i previously stated, I can't change the XSD.
|
|
|
|
|
You've got three choices.
1) Change the schema. Can't do it.
2) Change the transform. How are you using it?
3) Go away.
|
|
|
|
|
I'm using a .NET framework v1.0 so i'm restricted with which overload i can use in the transfrom method. What i do is give the Xsl a XPathNavigator that i created from the XmlDocument, i give it null for the arguments and a stream to write to:
<br />
string transfrormerStyleSheet = LoadTransfrormer();<br />
XmlDocument transformationDocument = new XmlDocument();<br />
transformationDocument.LoadXml(transfrormerStyleSheet);<br />
XmlNodeReader transformationReader = new XmlNodeReader(transformationDocument);<br />
XmlDocument guiXmlDocument = new XmlDocument(); <br />
xmlDocument.LoadXml(xmlAsString); <br />
<br />
XslTransform transformer = new XslTransform(); <br />
transformer.Load(transformationReader);<br />
<br />
XPathNavigator xpn = xmlDocument.CreateNavigator();<br />
FileStream fs = new FileStream(Environment.CurrentDirectory+"\\TempXMLstream.xml",FileMode.Create);<br />
StreamWriter sw = new StreamWriter(fs,System.Text.Encoding.UTF8);<br />
transformer.Transform(xpn,null,sw);<br />
sw.Flush();<br />
sw.Close();<br />
fs.Close();<br />
I need the stream to be in UTF8 specificly.
|
|
|
|
|
I am trying to read an XML document into a .NET DataSet object. I used the XSD.EXE utility to generate a schema file for this XML document. This schema has re-ocurring elements that I would like to load as records into my DataSet. However, I only want to load certain child elements as fields into the DataSet record.
Is there a way I can modify this schema file such that I can use the DataSet.ReadXml method to parse this XML file and create the proper table rows??
Thanks
|
|
|
|
|
What exactly are you using the dataset object for?
Matthew R. Sannes
Docsoft
Technical Marketing Specialist
www.docsoft.com
msannes@docsoft.com
|
|
|
|
|
Hi!
I´m using a xml document as a prices list for different customers.
The pricelist is often updated as prices changes and new
customers are added to the pricelist.
Now i`m a bit confused on how I should save the price list as there
are several ways of doing this. I could use:
XmlTextWriter tr = new XmlTextWriter("xmlPriceList.xml",null);
tr.Formatting=Formatting.Indented;
- xmlDoc.WriteContentTo(tr);
tr.Close();
or
- xmlDoc.WriteTo(tr)
or even
xmlDoc.save(..)
which one shall I choose? further I want to make sure my xmlDoc is well formed before it´s saved, but I don´t know how?
Thx
Thomas Andersson
|
|
|
|
|
I have an .xml file like this:
<group>
<line> some text</line>
<line> some text</line>
<line/>
<line> some text</line>
<line> some text</line>
</group>
and I want to transform it to a table like:
some text | some text | | some text | some text |
but the empty raw never appears. Empty tags are ignored? How can I preserve them?
|
|
|
|
|
Where is your transform?
This should do it.
<xsl:for-each select="group/item">
<tr><td><xsl:value-of select="."/></td></tr>
</xsl:for-each>
|
|
|
|
|
this is my transoform (part of the style sheet)
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"></td>
<td width="30" align="center"></td>
<td class="PoetryTitle"><xsl:value-of select="poem/stave/title"/></td>
<td width="10"></td>
</tr>
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"></td>
<td width="30" align="center"></td>
<td class="PoetrySubtitle"><xsl:value-of select="poem/stave/subtitle"/></td>
<td width="10"></td>
</tr>
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"></td>
<td width="30" align="center"></td>
<td class="EmptyLine">.</td>
<td width="10"></td>
</tr>
<xsl:for-each select="poem/stave">
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"><xsl:value-of select="number"/></td>
<td width="30" align="center"></td>
<td ><xsl:value-of select="verse"/></td>
<td width="10"></td>
</tr>
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"></td>
<td width="30" align="center"></td>
<td class="EmptyLine"><xsl:value-of select="emptyline"/></td>
<td width="10"></td>
</tr>
<tr>
<td width="80" valign="top"></td>
<td width="45" align="right" class="number"></td>
<td width="30" align="center"></td>
<td class="PoetryComments"><xsl:value-of select="notes"/></td>
<td width="10"></td>
</tr>
</xsl:for-each>
</table>
|
|
|
|
|
<xsl:value-of select="."/>
why the "."?
my workaround is: <emptyline>.<emptyline> and the color of the . is set to the background, so it looks like an empty line.
another problem is that I have text formated like this:
<line>first line</line>
<line> second line</line>
<line>third line</line>
but it appears like this (after transformation)
first line
second line
third line
"& nbsp ;" is rejected as invalid so I cannot use it for formatting.
|
|
|
|
|
This should work:
<xsl:text disable-output-escaping="yes"> </xsl:text>
Edward
|
|
|
|
|
Hi,
I need to convert some .xml files into tables so that they can be viewed in a web browser.
Is there a way to do that without to need learning XML/XSLT
If now what is the easiest and quickest way to do that? (I doubt I'll need to do anything similar again)
Is it possible to use XML/XSLT to generate these tables as a part of .html page created as a template with Dreamweaver.
Thank you! I've got scared by the size of these books about XML
|
|
|
|
|
XSLT for Dummies, learn to write XML transforms without reading.
Now wouldn't that be great.
You're going to have to get over it and learn something.
|
|
|
|
|
thanx
Any easy online sources to get me running in half a day I don't have much time to spend on that, which is the main problem.
|
|
|
|
|
You can do somthing like this:
dim nodes as xmlnodelist = xmlDoc.selectnodes("//root/whatever")
dim node as xmlnode
for each node in nodes
response.write("<div class=""" & node.name & """>" & node.innerText & "</div>");
next
This is kinda kludgy, you really want to use an xslt file But doing this you could create tables by making div tables with the sytlesheet.
Check this place out for info on XSLT:
XSLT Tutorial
|
|
|
|
|
I already read the XSLT tutorial it doesn't seem that hard as I thought. I have actually done almost all I wanted .
The only problem now is that I currently support XML compatible browsers only.
BTW. I've checked your article here and there is no source code attached to it.
Regards
|
|
|
|
|
Thanks for telling me, I fixed the link...
|
|
|
|
|
Hi,
I'm trying to convert the value of an element, into a string of a certain amount of characters - right justified.
e.g. <abc>123456</abc> into a 10-character string - " 123456"
How would this be done, if possible?
|
|
|
|
|
not easy to do in xslt - here is the "pure" way (you could just embed some c# code in the xslt)
xml source document:
<br />
<document><br />
<abc>1234</abc><br />
<abc>234234</abc><br />
<abc>21321</abc><br />
<abc>91243149384</abc><br />
</document><br />
xslt document:
<br />
<?xml version="1.0" encoding="UTF-8" ?><br />
<xsl:stylesheet <br />
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"<br />
version="1.0"><br />
<br />
<xsl:output method="xml" <br />
media-type="text/xml" <br />
indent="yes"<br />
encoding="UTF-8"/><br />
<br />
<xsl:template name="document"><br />
<xsl:apply-templates select="abc" /><br />
</xsl:template><br />
<br />
<xsl:template name="abc"><br />
<xsl:call-template name="padstring"><br />
<xsl:with-param name="times" select="10 - string-length(text())" /><br />
<xsl:with-param name="string"><xsl:value-of select="text()" /></xsl:with-param><br />
</xsl:call-template> <br />
</xsl:template><br />
<br />
<xsl:template name="padstring"><br />
<xsl:param name="current">1</xsl:param><br />
<xsl:param name="times" /><br />
<xsl:param name="string" /><br />
<xsl:param name="paddingchar"> </xsl:param><br />
<br />
<xsl:if test="$times > 0)><br />
<xsl:value-of select="$paddingchar" /><br />
</xsl:if><br />
<br />
<xsl:if test="not($times < $current) and $current != $times"><br />
<xsl:call-template name="padstring"><br />
<xsl:with-param name="current" select="$current + 1" /><br />
<xsl:with-param name="times" select="$times" /><br />
<xsl:with-param name="string" select="$string" /><br />
<xsl:with-param name="paddingchar" select="$paddingchar" /><br />
</xsl:call-template><br />
</xsl:if><br />
</xsl:template><br />
<br />
</xsl:stylesheet><br />
should work...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I'm a newbie,so please bear I have asp.net page which gets input from the user . I had to convert that input to xml and send it to the 3rd party database and get the output in xml . I convert that xml to html using XSL file by using Load and Transform methods in .NET
My XSL is similar to this .
This is simple part which is done .
The tricky part is After i display i do want to provide links to the elements displayed . I want to provide a link for these elements
so that when the user hits the link, the link spawn's another search and returns the result .I Was wondering how would i do that . Do i have to call etxernal objects from XSL to call the same ASPX page which i used previously to generate the original response.
Any thoughts appreciated...
|
|
|
|
|
One way would be to use an xml data island and some javascript to search and return the results while on the client side. Using a postback mechanism you could also post-back to your aspx and display the requested results.
|
|
|
|
|
Mark, I was thinking almost in the same lines as you mentioned to use javascript . But my search is actually not to an xml file its actually to a 3rd party xml database(xml webservice) . so i was thinking actually
to pass the values from XSL file to the aspx page and get the results .
|
|
|
|
|
Depending on the size of the data returned and your requirements you could still use the xml data island. As the page is initially rendered stuff the xml data island with the return from your database query. Then it is all client side javascript. Faster responses for the user but of course it only works for IE.
|
|
|
|
|
Params to the XSL file
Check this out I just posted it [Post]
You can send a param to the XSL and have it print it out as a link.
|
|
|
|
|
Does anybody know how to fill the fields of IE's web page
from within VB or C++ ? What if the page is secure? Of
course, there is no problem to fill all the fields by
hand. The question is how to do it automatically, by
running .exe or .dll.
|
|
|
|