|
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.
|
|
|
|
|
Take a look at IHTMLDocument and IHTMLElement)interfaces. In general you'd need to get a hold of html document, then get and html elemnt that you are interseted in (using probaly one of getElement.. methods) and then change it.
Edward
|
|
|
|
|
I'm needing to convert a supplied XML file into a text file to submit to a lodgement system.
<Extraction>
<BBRequest>
<BBB>Greg</BBB>
<ABC>Y</ABC>
<GKS>5000</GKS>
<POAddress>
<ABH>5 Rode rd</ABH>
<ABI>Hawthorne</ABI>
<ABJ>Brisbane</ABJ>
<ABK>4052</ABK>
</POAddress>
<POD>10</POD>
</BBRequest>
<ITLRequest>
<AWR>IV</AWR>
<ABB>2003</ABB>
<YYT>05072003</YYT>
<CZK>N</CZK>
<ABE>MRS</ABE>
<ABF>STEWART</ABF>
<ABG>JOY</ABG>
<BBB>LYNETTEV</BBB>
<POAddress>
<ABH>20 Waterworks Rd</ABH>
<AME>ALFREDTON</AME>
<AMF>VIC</AMF>
<APE>3350</APE>
</POAddress>
<HomeAddress>
<ABK>20 LAUDERDALE AVENUE</ABK>
<AXQ>ALFREDTON</AXQ>
<AXR>VIC</AXR>
<APH>3350</APH>
</HomeAddress>
<ACG>N</ACG>
<AMB>300</AMB>
<ANJ>C</ANJ>
<ABP>cleaner</ABP>
<ABO>9111</ABO>
<ATY>28630</ATY>
<ATD>5913</ATD>
<GKS>5885453745</GKS>
</ITLRequest>
</Extraction>
The required text file needs each request (BBRequest and ITLRequest) on a seperate line, and to have the list number at the front. Each of the 3 Letter Nodes (e.g. GKS)has to be put in the format ^NNNVVV (Nodename and Value). Finally, the count of requests has to be at the bottom.
00001^BBBGreg^ABCY^GKS5000^POAddress^ABH5 Rode rd^ABIHawthorne^ABJBrisbane^ABK4052^POD10^ZZZ
00002^AWRIV^ABB2003^YYT05072003^CZKN^ABEMRS^ABFSTEWART^ABGJOY^BBBLYNETTEV^ABH20 Waterworks Rd^AMEALFREDTON^AMFVIC^APE3350^ABK20 LAUDERDALE AVENUE^AXQALFREDTON^AXRVIC^APH3350^ACGN^AMB300^ANJC^ABPcleaner^ABO9111^ATY28630^ATD5913^GKS5885453745^ZZZ
Count: 2
The main problem I'm having is working out how to get the three letter node name into the final document, and how to list each transaction.
Any help would be muchly appreciated.
|
|
|
|
|
something like this would work:
<xsl:template match="Extraction"><br />
<xsl:for-each select="BBRequest|ITLRequest"><br />
<br />
<xsl:for-each select="*"><br />
<br />
^<xsl:value-of select="name()" /><xsl:value-of select="text()" /><br />
<br />
<-- get any details in subitems such as POAddress and HomeAddress --><br />
<xsl:for-each select="*"><br />
^<xsl:value-of select="name()" /><xsl:value-of select="text()" /><br />
</xsl:for-each><br />
<br />
</xsl:for-each><br />
<br />
</xsl:for-each><br />
</xsl:template>
the trick is to use the name() function to get the name of the node
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I want to POST something like this
http://xmlsearch.com/srch.asp?searchfor='test'
to the server and
the Server will respond by sending the XML data
I am using MFC and CInternetSession Class
How do i Parse the XML data ?
any suggestions and sample codes will be welcomed
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
|
This might help if you are using asp . You need to create a corresponding xsl
for the xml output. Then u can use the function below in your asp page .
<%
'Load the XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("Yourxmldoc.xml"))
'Load the XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("yourxsldoc.xsl"))
Response.Write(xml.transformNode(xsl))
%>
|
|
|
|
|
Hi all...
I m very new in JSP and Tomcat and stuff,
And I want to know where can I start from.
I already have the apache in c:\apache.
And already have the IIS from my WinXP installation.
Anyways...
I saw a document that said to download the JDK from:
http://java.sun.com/j2se/1.3/download.html[^]
And download the JSP enivorment(Tomcat) from:
http://java.sun.com/products/jsp/download.html[^]
So I did...
I think I downloaded the JDK. (or was it the SDK?)
I downloaded Tomcat 5 and extracted it to my c:\tomcat folder.
Now:
I open a cmd window...
I goes to c:\tomcat\bin
I run the startup file: startup.bat
AND...
the cmd window closes...
if anyone with expiriance is reading this message...
Please, Tell me what do I need to do
in order to make a simple jsp file that
gets data from a database
and displayes it as an HTML to the viewer???
=-=-=-=-=-=
The-Server
|
|
|
|
|
Works fine here. Have you set the JAVA_HOME and CATALINA_HOME environment variables? (The first should be set to your Java SDK path, e.g., C:\j2sdk-1.4.2 , and the second to your Tomcat path, e.g., C:\tomcat ).
Also, the current version of the Java SDK (previously known as the "JDK") is 1.4.2. Get it here:
http://java.sun.com/j2se/1.4.2/download.html[^]
- Mike
|
|
|
|
|
10x...
I guess the JAVA_HOME environment variable was missing.
cause after I added it, the Tomcat server start.
...
Now,
Only to create a database.
And create a .jsp file that will connect to that database
and generate an HTML.
Tips about how to and/or where to start from...
Will be mostly appricated.
=-=-=-=-=-=-=
The-Server
|
|
|
|
|
You really should focus on one thing at a time. First, play around with JSP to get an idea of how it works and get a feel for writing dynamic pages with JSP. There are plenty of tutorials for this, just check Google. Here's one that I ran across:
http://www.jsptut.com/[^]
Next, get familiar with a database system. MySQL is a popular choice for getting started, since it's free and has a Win32 version:
http://www.mysql.com/downloads/mysql-4.0.html[^]
There's also PostgreSQL, which is more powerful but trickier to get started with.
Finally, you can put them together. The standard way to interface with a database in Java is through JDBC. Simple tutorial:
http://java.sun.com/docs/books/tutorial/jdbc/[^]
- Mike
|
|
|
|
|
One more question,
A litle less, but still importent:
I have linux mandrake .
and I need to install the JDK
so I downloaded the file: JDK_file.rpm.bin
And executed it from the using the linux command: . JDK_file.rpm.bin
After the extrection...
I typed: ls . and saw the list of files.
2 files were there:
JDK_file.rpm.bin
and
install.something.1157
How do I run the .something file??
=-=-=-=-=-=-=
The-Server
|
|
|
|
|
I have a problem :
I have been developing an RSS feed in PHP. I have used the following RSS validator, and it states that it is valid RSS output :
http://feedvalidator.org/check?url=http%3A%2F%2Fqtextender.com%2Fforum%2Findex.php%3Fact%3Dmodule%26module%3Drecent%26limit%3D10%26admin_forums%3D%287%2C9%29
That is for the following url :
http://qtextender.com/forum/index.php?act=module&module=recent&limit=10&admin_forums=(7,9)
The problem is, when I enter the above url, it doesn't display at all within Internet Explorer. Why doesn't it display like The Codeproject's RSS feed?
http://www.codeproject.com/webservices/articlerss.aspx?cat=2
Do I need to output any specific headers?
Here's a link[^]
(the tages gets screwed up when trying to display in this forum) to the code.
Any help would be appreciated.
Jim
QTExtender - The OFFICIAL addon for QuoteTracker.
|
|
|
|
|
I know this really shouldn't be defeating me, but... I have a page where i'm using XSLT to transform a simple XML document (forum postings). This works fine, but if I want to display just one topic, i'm finding myself stuck. Using c# I can create an XmlNodeList containing the XML that I want, by performing a SelectNodes on an XmlDocument. This gives me the right data back, my XPath expression is fine. But! How do I then apply an XSL transform to that resulting nodelist? XSLT on seems to like XMLDocs, etc. Can I convert a NodeList to a Doc? I'm really stuck!
Am I going about this the wrong way? Any help, or hints, anything, would be very gratefully received!
|
|
|
|
|
You can use for-each statement in xslt and loop thru in xslt. But anyway you have to pass XMLDocument, not XMLNodeList. Pass the XPath as a parameter to XSLT or you can hardcode in xslt if it doesnt change.
You can check MSND for how to use for-each statement and Passing parameters to XSLT.
|
|
|
|
|
hi to u
, my project that i need asp.net program that take two file ,file of xml the other of dtd file , and take tha data from it and put it in database as access for example plz if u can help me plz u or ur freind plzzzzzzzzzzzz
samah
plz
|
|
|
|
|
Since you're using ASP.NET, just take advantage of the easy-to-use Xml web control. Give it an XML document, XSLT document, and render it (ASP.NET will do this when sending the response to a client browser). If you need this in a database, you can render it yourself and save the resulting document to a database.
You could also do this manually using the System.Xml.XmlDocument and System.Xml.Xsl.XslTransform classes. They do contain example source code.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have a web user control that contains some web server controls (Label, Texrbox, ddl,....) and I need to save the settings of those user control in an XML file using XML serialization. When I try to serialize any web server control I get the following error message:
"Can't serialize web control because there is no default constructor"
Please Help.
|
|
|
|
|
Classes need default constructors (constructors with no parameters) in order to serialized using the XmlSerializer . You'd have to extend these and implement a default constructor in the class itself.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|