|
Greetings,
Just when I thought I was getting better at XML/XSL I come across an article on MSDN with an XSL transform that has me puzzled. The basic premise is to use a DataAdapter to attach to a SQL DB, and DataSet to hold the data and and XSL to transform that data into an XML island for consumption by a control (almost exactly what I am trying to do).
Here is the portion of the XSL in question:
<xsl:for-each select="MyDataset/Table">
<xsl:text disable-output-escaping="yes">
<z:row lastname="</xsl:text>
<xsl:value-of select=" lastname"="">
<xsl:text>" OrderTotal="
<xsl:value-of select="OrderTotal">
<xsl:text disable-output-escaping="yes">"/>
And here is the exception that is thrown by this section of XSL:
<', hexadecimal value 0x3C, is an invalid attribute character. Line 22, position 19.
So what exactly is this for-each statement trying to do and why is it failing?
Your feedback would be greatly appreciate!
Rhoam
|
|
|
|
|
Ok, that didn't come out right. I've changed the brackets to <- and -> so the code would show. Sorry about that.
<-xsl:for-each select="MyDataset/Table"->
<-xsl:text disable-output-escaping = "yes"->
<-z:row LastName="<-/xsl:text->
<-xsl:value-of select="LastName"/->
<-xsl:text->" OrderTotal="<-/xsl:text->
<-xsl:value-of select="OrderTotal"/->
<-xsl:text disable-output-escaping = "yes"->"/><-/xsl:text->
<-/xsl:for-each->
|
|
|
|
|
Hi
I am trying to build a generic function to building forms using only ASP3.0, XML and XSLT.
The idea/theory is to be able to create a form holding any number of differing elements simply by passing a single variable to the XML and XSLT which would tell it which node in the XML to get the form structure. There by allowing control/creation of numerous forms simply through adding nodes to the xml file. Also the only time I want to hit the database is to insert the form data or pull values for an "edit form" feature (see below). The XML and XSLT will be standard text files, not stored on the database.
I have managed to the the form built correctly. The form layout is determined by the XSLT file and the form elements and thier associated attributes are based upon the XML file contents.
The problem I have run into is if I want to render a form which has one/some/all of the elements prepopulated I cannot do this in a generic fashion as I have to know exactly the quantity of parameters to have in the XSLT and to which bit in the XSLT they belong to.
Is there any way of using arrays within XSLT? If so I could then pass an array to it using ASP that is filled with either values or NULL's whereby I can do something like
<INPUT NAME="@NAME" TYPE="TEXT" MAXLENGTH="@MAXLENGTH">
<xsl:if test="$array[x] != 'NULL'">
<xsl:attribute name="VALUE">
<xsl:value-of select="$array[x]" />
</xsl:attribute>
</xsl:if>
</INPUT>
Where x corresponds to the element in question.
Current example:
http://www.safari-trader.com/functions/form_builder/index.asp
http://www.safari-trader.com/functions/form_builder/forms.xml
http://www.safari-trader.com/functions/form_builder/forms.xslt
Any help/pointers would be appreciated....
John
|
|
|
|
|
John,
I think what you want is XForms, not XSLT.
Have a look at this (slightly outdated but nonetheless a good intro): http://www-106.ibm.com/developerworks/web/library/x-xforms/?loc=dwmain
Bernd
|
|
|
|
|
Hi Bernd
Thanks for this but the problem here is that XForms is not yet a standard and I need to get something implemented fairly soon.
|
|
|
|
|
Hello? Does anyone actually read this forum?
J
May the bear never have cause to eat you.
|
|
|
|
|
sure... why not?
"No matter where you go, there your are..." - Buckaoo Banzi
<pete>
|
|
|
|
|
*cricket*
*cricket*
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I read it!
(better late than never )
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Is there a nice way to do this?
For instance, if I have the following two DOMS:
<document>
<collection>
<book>First</book>
<book>Second</book>
</collection>
</document>
and
<document>
<collection>
<book>Third</book>
<book>Fourth</book>
</collection>
</document>
I would like to end up with the following:
<document>
<collection>
<book>First</book>
<book>Second</book>
<book>Third</book>
<book>Fourth</book>
</collection>
</document>
I know I can do it programmatically, but I'd love to find a way to merge it for free. I haven't found a method to do it... Will I have to use XSL?
J
<small><center>May the bear never have cause to eat you.</center></small>
|
|
|
|
|
At the KB article below, some VB is shown that can merge two XML documents. You could modify it so it would run in a .vbs file (instead of a VB project I think?), but that would take all of two minutes.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q286817[^]
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Right. I had found that one. I was hoping somebody would point out the magical-yet-hidden "merge" method on the IXMLDOMNode interface.
I guess I'm going to have to do it by hand.
J
May the bear never have cause to eat you.
|
|
|
|
|
I am looking into XForms. Anybody out there who can share some experience? How steep is the learning curve? What rendering engine do people use? Does it do what it's supposed to do? That kind of stuff...
I am in particular interested in using XForms not for web forms, but for data-driven application development similar to what mozilla.org does with XUL.
TIA,
Bernd
|
|
|
|
|
|
Thanks for the link. Sadly, all alternatives to XForms I have seen, including XUL and the stuff you suggest, are nowhere close to what XForm promises (and nowhere close to the level of standardazation XForms have).
It remains to be seen if XForms can deliver what I need (still several hundreds of pages of W3C doc to go through), but the technology certainly is superior to what Rusan proposes. Rusan, basically, converts an .RC file into XML (well - sort of, as a short summary). On top of that, XForms offer restrictions, event handling, correlations and relations between elements, a submission protocol, ...
Bernd
|
|
|
|
|
I have read a little on XUL, but not on XForms. I'm also working on a very simply App that uses MSHTML for part of it's GUI, including live data editing. I'm very impressed with this approach at implementing GUI's for certain (simple) types of applications.
Are there any Windows GUI XForms implementations around?
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Try google. There are a couple of implementations, including IE plug-ins. I haven't tried any yet. In howfar any of these implementations allow for XForm-driven standard Windows dialogs (as opposed to browser-based forms) remains to be seen. I am interested in that, too.
What makes XForms superior to approaches like XUL is that no or little scripting is required. XUL, appart from being tied to Gecko, still requires JavaScript for event handling and inter-control dependencies. Having just said that; W3C specifications are a dull reading and I have another ~200 pages to go on the XForms 1.0 spec.
Bernd
|
|
|
|
|
Does anyone have a comprehensive list of reserved XML words such as "child" which can't be used to defined a field?
Thanks
Allan
|
|
|
|
|
There is no reserved keyword in Xml. "child" is ok.
|
|
|
|
|
Surely if setting an xpath you can't apply the word "child"?
|
|
|
|
|
Sure you can. It is all in is it placed appropriately in the correct syntax. Not private words like a programming language.
"I will find a new sig someday."
|
|
|
|
|
Thanks for the feedback.
Cheers
Allan
|
|
|
|
|
How could an if statment comes true if there is a child node of current node. It must be general,
<xsl:if test="?">
...
and recursion works in <xsl:apply-template>.
karanba
|
|
|
|
|
XSL has a function called count. So you need to ask if a count of the child nodes is greater than 0.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have got one more question for you Christian. Here it is :
Thanks.
|
|
|
|