|
oh I don't undestand what is your goal. Plz try to edit your post (modify) so we can see <xsl:value-of select="name"> - I don't think everybody looks at source code to see what you indended to write - you have to check "do not treat..." or escape all < and >.
Do you have XML like <name>www.codeproject</name> and you want to do what with it? transfrom it to hyperlink?
One way is:
<br />
<a><br />
<xsl:attribute name="href"><br />
<xsl:value-of select="name" /><br />
</xsl:attribute><br />
<xsl:value-of select="name" /><br />
</a><br />
Or do you want something else?
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi all,
I am new to XML. I am trying to fill a Dataset with the help of XML. But what I want to do is to verify the data against an XML schema file(XSD file) and then fill it in the Dataset. Is it possible. If yes can anyone help me please.
|
|
|
|
|
Can you put me on the track for understanding and creating web services? I have gone through w3schools tutorials about SOAP but with that I could not write any web services.
When I google for web services there are lot of tutorials.
There are SOAP,REST etc don't know what they are.
I want to use PHP for web services.
Please help
Ranjan
|
|
|
|
|
Hi,
This project is on developing a portal using DiGIR technology. There is a portal.xml file that need to be edited.I'm confused and not sure which part is need to be edited.This project is basically run by two environment which consist of engine and presentation layer. The problem is taht I can't insert the provider to the portal.According to relevant source there is a problem in the schema file.
<br />
<providerFilter>org.calacademy.digir.engine.Darwin2ProviderFilterer</providerFilter><br />
<xmlSchema><br />
<namespace>http:
<handle>xsi</handle><br />
</xmlSchema><br />
<protocolSchema><br />
<namespace>http:
<location>http:
<handle>digir</handle><br />
</protocolSchema><br />
<contactEmail>your.name@your.domain.com</contactEmail><br />
</config><br />
<!--
Please reply as soon as possible to whom it's concern.
Thank you.
|
|
|
|
|
ok,
first, do you know that you can edit your (non-anonymous) post? There is no need to post it again.
and second, if I understand correctly that problem is with editing some (configuration?) file - portal.xml, so you should seek help at DiGIR website...
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
hi there,
i got a little problem diving me crazy:
i got a new pc with winXP SP2 installed and i can't install the SVG viewer (and some more drivers/plugins)
i think it's some kind of protection but i really don't know what to do!
can anybody help me?
thans in advance!
fuel2run
|
|
|
|
|
Hello,
I am trying to create a webservice that will enable me to retrieve rows from a database in sql. I would like the service to return the datatable filled with the records. So that the consumer can display in a datagrid. But l am not sure if l am going about it correctly.
This is my code below.
[WebMethod (Description="This will get retrieve customers' orders")]<br />
public DataTable RetrieveOrders()<br />
{<br />
SqlConnection cnn = new SqlConnection("Server = Steves-pc; Database = northwind; Integrated Security = yes");<br />
cnn.Open();<br />
SqlDataAdapter da = new SqlDataAdapter();<br />
SqlCommand cmd = new SqlCommand();<br />
DataTable dt = new DataTable("Orders");<br />
<br />
string getOrders = "SELECT OrderID,CustomerID,ShipName,ShipCountry FROM Orders";<br />
cmd = cnn.CreateCommand();<br />
cmd.CommandType = CommandType.Text;<br />
cmd.CommandText = getOrders;<br />
da.SelectCommand = cmd;<br />
<br />
dt.Clear();<br />
da.Fill(dt);<br />
<br />
cnn.Close();<br />
<br />
return dt; <br />
}
Many thanks in advance,
Steve
|
|
|
|
|
Here's a quick code diagnosis:
steve_rm wrote:
cnn.Open();
This line is not needed since you are using an SqlDataAdapter. The SqlDataAdapter automatically calls the SqlConnection.Open() and SqlConnection.Close() methods.
steve_rm wrote:
SqlCommand cmd = new SqlCommand();
You don't need to initialize this variable since you are re-assigning it later in your code:
steve_rm wrote:
cmd = cnn.CreateCommand();
You should set SqlCommand cmd = null; .
This call is not needed since the DataTable is empty after creation:
steve_rm wrote:
dt.Clear();
As previously stated, this line is not needed (see above).
steve_rm wrote:
cnn.Close();
Hope this helps!
~Javier Lozano
(blog)
|
|
|
|
|
Hi
I need a help Pls Its very urgent , help me to get out
I have doen a pgm to read
any schema file(.xsd) and load data's into a xml file(resultant file).
Here what I had done inside the Load button is that for any datatypes
in the schema, enter the values as james for string, 100 for interger
like that, I have specified by using the SWITCH statement. But my
requirement is such that , when I entered the .xsd file and resultant xml file then when i click the Load Button, It should create around 200 data's but, the data's should differ form each other.
I dont know how to do this. Pls help me. Here I am sending the coding
again.create a new project with c# windows application, copy this
coding and run and see.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using System.Xml.Schema;
namespace testdatagenerator
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtSchema;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox txtXml;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Data.DataSet dataSet1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.txtSchema = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.txtXml = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet1 = new System.Data.DataSet();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
this.SuspendLayout();
//
// txtSchema
//
this.txtSchema.Location = new System.Drawing.Point(88, 24);
this.txtSchema.Name = "txtSchema";
this.txtSchema.Size = new System.Drawing.Size(440, 20);
this.txtSchema.TabIndex = 0;
this.txtSchema.Text = "";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button1.Location = new System.Drawing.Point(536, 24);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "Browse";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// txtXml
//
this.txtXml.Location = new System.Drawing.Point(88, 64);
this.txtXml.Name = "txtXml";
this.txtXml.Size = new System.Drawing.Size(440, 20);
this.txtXml.TabIndex = 2;
this.txtXml.Text = "";
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button2.Location = new System.Drawing.Point(536, 64);
this.button2.Name = "button2";
this.button2.TabIndex = 3;
this.button2.Text = "Load";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button3.Location = new System.Drawing.Point(616, 64);
this.button3.Name = "button3";
this.button3.TabIndex = 4;
this.button3.Text = "Save";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.DataSource = this.dataSet1;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 120);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(776, 320);
this.dataGrid1.TabIndex = 5;
//
// dataSet1
//
this.dataSet1.DataSetName = "NewDataSet";
this.dataSet1.Locale = new System.Globalization.CultureInfo("en-US");
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(808, 454);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.txtXml);
this.Controls.Add(this.button1);
this.Controls.Add(this.txtSchema);
this.Name = "Form1";
this.Text = "TestDatagenerator";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "select schema file" ;
fdlg.InitialDirectory = @"c:\CDEV\testdatagenerator" ;
fdlg.Filter = "schema files(*.xsd) |*.xsd| all files(*.*) | *.*";
fdlg.FilterIndex = 2 ;
fdlg.RestoreDirectory = true ;
if(fdlg.ShowDialog() == DialogResult.OK)
{
txtSchema.Text = fdlg.FileName ;
}
}
private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0;
foreach (DataColumn dColmn in dTbl.Columns)
{
switch(dColmn.DataType.ToString())
{
case "System.String":
oValues[i] = (string) "This is string";
break;
case "System.Int32":
oValues[i] = (int) 100;
break;
case "System.DateTime":
oValues[i] = new DateTime(2004,10,12);
break;
case "System.Decimal":
oValues[i] = new Decimal(999999999.99);
break;
case "System.Int16":
oValues[i] = (short) 32767;
break;
case "System.Int64":
oValues[i] = (long) 9223372036854775807;
break;
case "System.Double":
oValues[i] = (double) 888888888888888;
break;
}
i += 1;
}
dTbl.Rows.Add(oValues);
}
}
private void button3_Click(object sender, System.EventArgs e)
{
dataSet1.WriteXml(txtXml.Text,XmlWriteMode.WriteSchema );
MessageBox.Show("Saved");
}
}
}
|
|
|
|
|
Hello there,
I'm using XML to develop portal using DiGIR(Distributed Indegenous Generic Information Retrieval) technology.
My problem here is I couldn't insert my provider in the portal that I have developed.
Here is the portal.xml file.
Please tell me where is the problem.
Please reply.Thank you.
<config xmlns="http://www.calacademy.org/portal" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.calacademy.org/portal portal.xsd">
<version>0.95
<http>
<maxconnections>500
<maxconnectionsperhost>50
<connectionwaittime>10
<connectionestablishmenttimeout>10
<connectionresponsetimeout>30
<connectionretries>3
<handlerpoolthreadmax>15
<configrefreshinterval>0
<providercacherefreshinterval>300
<registry>
<uddiinquiryurl>http://uddi.microsoft.com/inquire
<uddiservicekey>UUID:4DFAB7E8-6387-431D-BC20-6291E99A51A8
<provider>
<name>MIMODS Provider
<accesspoint>http://202.185.72.215/digir/DiGIR.php
<providerfilter>org.calacademy.digir.engine.Darwin2ProviderFilterer
<xmlschema>
<namespace>http://www.w3.org/2001/XMLSchema-instance
<handle>xsi
<protocolschema>
<namespace>http://digir.net/schema/protocol/2003/1.0
<location>http://digir.sourceforge.net/schema/protocol/2003/1.0/digir.xsd
<handle>digir
<contactemail>your.name@your.domain.com
|
|
|
|
|
I have a program that uses xpath expressions to navigate an XPathDocument, e.g.
dim iter as XPathNodeIterator = myNav.Select(myXpathExpression) Today, to make the XML source document easier to edit, I added a target namespace, i.e.
<MyDocElement xmlns="http://x.y.com/abc/Mapping.xsd"> .
After I did this, my xpath expressions no longer work. Does anyone know what I need to do to make them work again? (Note that I am not using a namespace prefix).
my blog
|
|
|
|
|
hi,
I can remember I had similar problem long time ago... I can't recall how I solved that one, bt why are you not using namespace prefix? It should work with it and I see no reason why not to use it...
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
The xml file is large - originally generated, and then hand-modified. I do not want to use namespace prefixes unless I have to, as
1) they will bloat the file
2) it will take a while to edit the file
my blog
|
|
|
|
|
oh now I don't even know what I meant
Try to add namespace prefix into XPath query. If it wont work say "DNH is idiot" (cuz i think there is no difference when you have namespace prefix in every element or only in parent) and look at link I provide you now;
hopefully the answer will be here[^]
I didn't read it all bt it looks promising.
Here is quite late night so I'll leave it alone for now. plz if you'll find answer post it here.. In other case I'll look at it tomorrow...
good luck,
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
I finally found something what seems to be solution...
[ snippet is from my website's rss feeder - i *think* it worked...]
<br />
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);<br />
nsmgr.AddNamespace("ns",@"http://www.w3.org/1999/xhtml");<br />
<br />
XmlNodeList newsNodes = doc.DocumentElement.SelectNodes("//ns:body/ns:form/ns:div[@class='parent']/ns:div[@class='contents']/ns:div[@class='news']",nsmgr);<br />
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Yes! Thanks, that works great.
my blog
|
|
|
|
|
i want to check for the value of xml node to be compulsory through XSD (schema file),,,
i have tried minoccurs and nillable!
Can anyone Help me out!
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
Hmm and what exactly is your goal?
To allow element have no content, check
http://www.w3.org/TR/xmlschema-1/#xsi_nil[^]
"An element so labeled must be empty, but can carry attributes if permitted by the corresponding complex type."
Minoccures attribude specifies number of occurences of (child) element.
May the W3ForCe be with you.
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
thanks man!
i got the solution...
Happy New Year by the way
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
Well as the W3C can always change/update the XML standards then will the applications developed based on .Net XML related classes be affected? Will there be any problem running these application later on. If yes, how can we keep our applications up to date.
|
|
|
|
|
I have a 4 X 4 matrix that represents a topologoy. suppose connected is that matrix. if connected[i,j]=1 then there is a edge between node i and node j. If connected[i,j]=0 then there is no edge. I want to encode this in XML format such that it must draw this network topology.
Any one help will be greatly appreciated.
|
|
|
|
|
hi there,
so you want to represent graph in XML... nice homework, I guess
If you want to represent that matrix, what about:
<matrix>
<row>
<col connected="1" /><col/><col/><col/>
</row>
<row>
<col/><col/><col connected="1"/><col/>
</row>
<row>
<col/><col/><col/><col/>
</row>
<row>
<col/><col/><col connected="1"/><col/>
</row>
</matrix>
My first idea and indeed far from ideal structure for this task. However I gave you some ideas hopefully.
It's, of course, too much verbose representation of your graph.
What about
<graph>
<edge start="1" end="5" />
<edge start="4" end="2" />
.
.
.
</graph> ?
There you have some representations... Think about it (do not shoot like I do!) and choose the best for u
does it help?
best regards,
David 'DNH' Nohejl
Never forget: <i>"Stay kul and happy"</i> (I.A.)
|
|
|
|
|
hi!!
i'm trying to process an xml file containing document tags & text, and skip certain blocks of the text based on condition tags. the problem i'm finding is that when i use apply-templates to move on and skip blocks of the document, it doesn't actually miss any of the text that i'm trying to avoid outputting to the resultant html document. i guess the question i have is, can you actually jump around an xml document using apply-templates?? i'm quite new to this stuff so please bear with me if i'm doing something wrong.
i've copied the code below just incase you want to see what i'm actually trying to do & run the transform for yourself. you'll need to create the following three files:
source.xml, "merge-data.xml" & test.xsl
(the file name in quotes has to have that exact name and be in the same directory as the stylesheet unless you want to change the code in the stylesheet).
source.xml:
<?xml version="1.0" encoding="UTF-8"?>
<br>
<!-- SOURCE DOCUMENT TO BE TRANSFORMED -->
<br>
<doc>
<page>
<content>
<para>
<run>
<text>
<condition eval="THIS = 'TEST'"><<IF THIS = 'TEST'>></condition>
</text>
</run>
</para>
<para>
<run>
<text>IF EVALUATED TO TRUE!!!</text>
</run>
</para>
<para>
<run>
<text>
<condition eval="ELSE"><<ELSE>><<IF THIS = 'TEST'>></condition>
</text>
</run>
</para>
<para>
<run>
<text>IF EVALUATED TO FALSE!!!</text>
</run>
</para>
<para>
<run>
<text>
<condition eval="END"><<ENDIF>><<IF THIS = 'TEST'>></condition>
</text>
</run>
</para>
</content>
</page>
</doc>
"merge-data.xml":
<?xml version="1.0" encoding="UTF-8"?>
<!-- source document's condition information (merge-data.xml) -->
<dataset>
<condition ref="<<IF WEATHER = 'BAD'>>">TRUE</condition>
<condition ref="<<IF THIS = 'TEST'>>">TRUE</condition>
<condition ref="<<IF THISDATA = 'RANDOM'>>">TRUE</condition>
</dataset>
test.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<!-- xslt stylesheet -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sdp="http://www.sectornet.co.uk/2004/DocPro">
<xsl:output method="html"/>
<xsl:variable name="mergeData" select="document('merge-data.xml')//dataset"/>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="/">
<html>
<head>
<title>condition test output.</title>
</head>
<body>
<center>
<h1>Condition Test.</h1>
</center>
<xsl:apply-templates select="doc/page/content"/>
</body>
</html>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="text">
<xsl:apply-templates/>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="condition">
<xsl:variable name="curNode" select="."/>
<xsl:text> (CONDITION) </xsl:text>
<xsl:choose>
<xsl:when test="$curNode/@eval = 'ELSE'">
<!-- process else statement -->
<xsl:variable name="prevIfNode" select="$mergeData/condition[@ref = substring-after($curNode, '<<ELSE>>')]"/>
<xsl:if test="$prevIfNode = 'TRUE'">
<!-- go to end tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ENDIF>>', $prevIfNode/@eval)]"/>
</xsl:if>
</xsl:when>
<xsl:when test="$curNode/@eval != 'END'">
<!-- process if statement -->
<xsl:variable name="curIfNode" select="$mergeData/condition[@ref = $curNode]"/>
<xsl:if test="$curIfNode != 'TRUE'">
<xsl:choose>
<xsl:when test="ancestor::*/following::*/condition/text() = concat('<<ELSE>>', $curNode)">
<!-- go to else tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ELSE>>', $curNode)]"/>
</xsl:when>
<xsl:otherwise>
<!-- go to end tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ENDIF>>', $curNode)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
thanks!!!
|
|
|
|
|
I've just realised that by changing the conditions return value from "TRUE" to "FALSE" (see merge-data.xml above), you can see it skipping the block. this is great, but after it's skipped the block it returns and continues processing from it's original position. e.g. it meets the first condition tag (if statement), then the template causes the jump to the else block because the if evaluates to false, but once that call has been completed it continues from the original condition tag (if statement). so basically the apply-templates is put on a call stack as it is in most programming languages' function calls. something i hadn't realised!! the problem is how to prevent it from continuing along nodes that i want to skip. i'm pretty sure it's down to the initial <xsl:apply-templates select="doc/page/content"/> found in the root template. it's obviously going to end up calling a template for all implemented tags under the content node. can anyone see a way to change this statement to be a bit more selective in which nodes it processes? or any other suggestions would be great!!
thanks!!
|
|
|
|
|
Just incase anyone would find this helpful, i've got it working. it's not really how i wanted it to be written, so if anyone can see a better way of doing it then please say. i've also added another special document control called a dataname (basically a variable), so by adding text to the document enclosed in <dataname> tags with a reference to that and its value in the merge-data.xml file (e.g. <dataname ref="<<CFNAME>>">RICH</dataname> then you can effectively merge data into the document. the stylsheet code is copied below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sdp="http://www.sectornet.co.uk/2004/DocPro">
<xsl:output method="html"/>
<xsl:variable name="mergeData" select="document('merge-data.xml')//docpro-print-entry/dataset"/>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="/">
<html>
<head>
<title>condition test output.</title>
</head>
<body>
<center>
<h1>Condition Test.</h1>
</center>
<xsl:apply-templates select="doc/page/content/para[1]"/>
</body>
</html>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="text">
<xsl:choose>
<xsl:when test="count(self::*/*) > 0">
<!-- we have controls in this block -->
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<!-- output text and move on to next block -->
<xsl:value-of select="."/>
<xsl:apply-templates select="ancestor::*/following-sibling::*[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="dataname">
<xsl:param name="sourceContext" select="$mergeData"/>
<xsl:variable name="curNode" select="."/>
<xsl:value-of select="$sourceContext//dataname[@ref = $curNode]"/>
<!-- move on to next block -->
<xsl:apply-templates select="ancestor::*/following-sibling::*[1]"/>
</xsl:template>
<!-- ++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++ -->
<xsl:template match="condition">
<xsl:variable name="curNode" select="."/>
<xsl:choose>
<xsl:when test="$curNode/@eval = 'ELSE'">
<!-- process else statement -->
<xsl:variable name="prevIfNode" select="$mergeData/condition[@ref = substring-after($curNode, '<<ELSE>>')]"/>
<xsl:choose>
<xsl:when test="$prevIfNode != 'TRUE'">
<!-- continue through the block -->
<xsl:apply-templates select="ancestor::*/following-sibling::*[1]"/>
</xsl:when>
<xsl:otherwise>
<!-- go to end tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ENDIF>>', $prevIfNode/@ref)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$curNode/@eval != 'END'">
<!-- process if statement -->
<xsl:variable name="curIfNode" select="$mergeData/condition[@ref = $curNode]"/>
<xsl:choose>
<xsl:when test="$curIfNode = 'TRUE'">
<!-- continue through the block -->
<xsl:apply-templates select="ancestor::*/following-sibling::*[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="ancestor::*/following::*/condition/text() = concat('<<ELSE>>', $curNode)">
<!-- go to else tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ELSE>>', $curNode)]"/>
</xsl:when>
<xsl:otherwise>
<!-- go to end tag -->
<xsl:apply-templates select="ancestor::*/following::*/condition[text() = concat('<<ENDIF>>', $curNode)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$curNode/@eval = 'END'">
<!-- continue past the block -->
<xsl:apply-templates select="ancestor::*/following-sibling::*[1]"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|
|
|
|