|
I can't quite see all your XML. Did you use the check box to ignore html tags? Anyways, if candidateID is not an attribute in there, then it certainly won't show up in your input tag. But, what you're looking at with proc.addParameter is that a parameter is being passed into the XSL for processing. Up at the top of the XSL should be a xsl:param tag for candidateID if that is indeed one of the items in the querystring or form. To access it use $candidateID instead of @candidateID . The $ is used for variables and the @ is used for attributes.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
BEAUTIFUL!! It works! Thanks so much!
|
|
|
|
|
Anybode have done like:
Node BOOK1 in a GroupBox and all the inner nodes(title1,author1 etc...) as an LABEL inside the node BOOK1.New GroupBox for BOOK2 and same for that...Please help....
<bookstore>
<book1 genre1="autobiography" publicationdate1="1981" ISBN1="1-861003-11-0">
<title1>The Autobiography of Benjamin Franklin</title1>
<author1>
<first-name1>Benjamin</first-name1>
<last-name1>Franklin</last-name1>
</author1>
<price1>8.99</price1>
</book1>
<book2 genre2="novel" publicationdate2="1967" ISBN2="0-201-63361-2">
<title2>The Confidence Man</title2>
<author2>
<first-name2>Herman</first-name2>
<last-name2>Melville</last-name2>
</author2>
<price2>11.99</price2>
</book2>
</bookstore>
fghfhgfgcncnb
|
|
|
|
|
To the point, I want to create a table on class XML summary comment. Well I want to create the table because I want to use NDoc to build the documentation of the class of my library. But I don't know how to create it. The table is static not load data on database (SQL, MySQL, etc.) it just like this :
Can anyone help me, please.
Regards,
Ariston Darmayuda.
|
|
|
|
|
You can use a list :
<summary>
This is a table.
<list type="table">
<listheader>
<term>Col A</term>
<term>Col B</term>
</listheader>
<item>
<description>1</description>
<description>2</description>
</item>
<item>
<description>3</description>
<description>4</description>
</item>
</list>
</summary>
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi, I have a xml string that I have to parse. I am using xpath to parse this string. I can get to the part <b>A1:ABCID="4567"</b> but when I try to access <b>A2:parentid="0123"</b>. It doens't let me.
can some help me out with the syntax example?
thanks
XML string is:
<?xml version="1.0" encoding="utf-16"?>
<A1:MyName A1:ABCID="4567" A2:parentid="0123"
xmlns:A2="http://abc.cdf.com/MySubscription/SinIN/2006/response"
xmlns:A1="http://abc.cdf.com/MySubscription/SinIN/2005/response>"
<A1:Necessities>"
<A1:Necessity A1:ID="3" />"
</A1:Necessities>"
</A1:MyName>"
-- modified at 10:22 Tuesday 8th August, 2006
Thanks
Needy
|
|
|
|
|
Hi,
I need to add, remove or make optional, some elements based on the values of an attribute of the parent element.
I have an element "report" that has an attribute "investortype", which can have 3 possible values: "none", "indvidual" and "group".
Now what i need is, to create/modify elements in the report element based on these 3 values. The following example will elaborate:
investortype = "individual"
---------------------------
<report
reportname="ABCD"
destinationdir="C:\XSD"
outputfilename="$DATE1$-ABCD.txt"
investortype="none">
<!-- Both elements below should be Optional-->
<investorcode code="316" />
<investorrange start="316" end="317"/>
</report>
investortype = "group"
---------------------------
<report
reportname="ABCD"
destinationdir="C:\XSD"
outputfilename="$DATE1$-ABCD.txt"
investortype="none">
<!-- Atleast one of the two is required -->
<investorcode code="316" />
<investorrange start="316" end="317" />
</report>
investortype = "none"
---------------------
<report
reportname="ABCD"
destinationdir="C:\XSD"
outputfilename="$DATE1$-ABCD.txt"
investortype="none">
<!-- None of the 2 should be present -->
</report>
Any help or hint would be great. Also i need to know if this is even possible in XSD?
Awaiting reply and Thanx in advance
☺«««DTA»»»☺
|
|
|
|
|
hi there,
I used to place a meta refresh (forwarding to a page explaining that javascript is required) within a noscript tags in my header. it looked like this and worked fine:
<head>
... stuff here...
<noscript>
<meta http-equiv="refresh" content="0;url=myerrorpage.aspx" />
</noscript>
</head>
but nowadays I swim with the river and try to be standards complient. I use the w3c validators to validate my xhtml. it throws an error because it doesn't like the noscript tags. I wonder how I can check wether the clientbrowser supports javascript with this limitation.
how do you folks do it?
thanks in advance!
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
So if the user doesn't support javascript, what do you want to do?
/\ |_ E X E GG
|
|
|
|
|
hi eggie,
thanks for your reply. in case the client browser does not support javascript or has javascript disabled, i want to send him to a specific page where he gets some information about the basic requirements to access the site.
regards!
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
Hi
I am now using xlst to write out my xml doc as a HTML string instead of using selectnode etc. It's neat. But....I can't work out how to specify search criteria for the xml doc. I just get it all. Sample below :-
XML DOC
<Fields>
<BatchParam name="Field 1" tab="Tab 1" Seq="1" />
<BatchParam name="Field 2" tab="Tab 1" Seq="3" />
<BatchParam name="Field 3" tab="Tab 1" Seq="2" />
<BatchParam name="Field 1" tab="Tab 2" Seq="1" />
<BatchParam name="Field 2" tab="Tab 2" Seq="3" />
<BatchParam name="Field 3" tab="Tab 2" Seq="2" />
<BatchParam name="Field 1" tab="Tab 3" Seq="1" />
</Fields>
I want to display a specific tab, eg Tab 2 in a table, ordered by seq
My XSL
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='/ | @* | node()'>
<xsl:copy>
<xsl:apply-templates select="node()">
<xsl:sort select='@seq'/>
</xsl:apply-templates>
</xsl:copy>
<tr>
<td>
<xsl:value-of select='position()'/>
</td>
<td>
<xsl:value-of select='@tab'/>
</td>
<td>
<xsl:value-of select='@name'/>
</td>
<td>
<xsl:value-of select='@seq'/>
<br/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
and finally my C# code
System.IO.StringWriter objStream = new System.IO.StringWriter();
System.Xml.Xsl.XslTransform objTransform = new System.Xml.Xsl.XslTransform();
objTransform.Load(madconfig.Config.Get("MYXSLFILE.XSL"));
System.Xml.XPath.XPathDocument xml = new System.Xml.XPath.XPathDocument("MYXMLFILE.XML");
System.Xml.XPath.XPathNavigator xmlNav = xml.CreateNavigator();
objTransform.Transform(xmlNav, null, objStream, null);
Response.Write ("<table border=1>"+objStream.ToString()+"</table>");
And this displays ALL the entries. Before, rolling my own I did something like
string tabName = GetTabName();
System.Xml.XPath.XPathExpression expr = xmlNav.Compile("/Fields/BatchParam[@name=\""+tabName+"\"]");
System.Xml.XPath.XPathNodeIterator iterator = xmlNav.Select(expr);
Any ideas...?
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
So...you can pass parameters down. But I am still struggling. This is where I am now...
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="tabName" select="Main"></xsl:param> <-- MY PARAM
<xsl:template match="Fields">
<table border="3">
<xsl:copy>
<xsl:apply-templates select="BatchParam">
<xsl:sort select='@tab'/>
<xsl:sort select='@seq'/>
</xsl:apply-templates>
</xsl:copy>
</table>
</xsl:template>
<xsl:template match="BatchParam[@tab='Main']"> <-- WHERE I WANT TO USE IT
<tr>
<td><xsl:value-of select='position()'/></td>
<td><xsl:value-of select='@tab'/></td>
<td><xsl:value-of select='@name'/></td>
<td><xsl:value-of select='@seq'/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
If I replace the hardcoded 'Main' with the param as in
<xsl:template match="BatchParam[@tab=$tabName]">
I get an exception...
System.Xml.XPath.XPathException: 'BatchParam[@tab=$tabName]' is an invalid key pattern. It either contains a variable reference or 'key()' function.
Help!!!!
Regards
<strike>Angel</strike>Malcolm
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Malcolm Smart wrote: <xsl:param name="tabName" select="Main"></xsl:param>
This line is a little odd. This is a template parameter, not a variable. The difference is that you're supposed to be passing this parameter in when you call the stylesheet. There are also parameters for template matching sections. You can put a variable instead:
<xsl:variable name="tabName"></xsl:variable>
Also, your select is not going to put the string 'Main' into tabName. It's going to try and find a node called Main and put it there. You could stick text into it if you want:
<xsl:variable name="tabName"><xsl:text>Main</xsl:text></xsl:variable>
As for your XPath statement, I'm unsure why it gave you that error. Try changing to a variable with text and see how it reacts.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi Thanks for the info...still no joy (and I am trying - have been all ****** afternoon...)
Overall reqs are - use select tab from front end. I extract just the nodes which have the tab attribute set to this tab. So a) I need to be able to pass the tab name down from the front end into the xsl and b) use it in teh xsl. I am still struggling with b) and not even looked at a) yet!!
My code now, with your changes, still gives the exception....I need a little more hand holding. This is my first venture into XSL and really struggling, both conceptually, and syntactically.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="tabName">
<xsl:text>Main</xsl:text>
</xsl:variable> <xsl:template match="Fields">
<table border="3">
<xsl:copy>
<xsl:apply-templates select="BatchParam">
<xsl:sort select='@tab'/>
<xsl:sort select='@seq'/>
</xsl:apply-templates>
</xsl:copy>
</table>
</xsl:template>
<xsl:template match="BatchParam[@tab=$tabName]"> <tr>
<td><xsl:value-of select='position()'/></td>
<td><xsl:value-of select='@tab'/></td>
<td><xsl:value-of select='@name'/></td>
<td><xsl:value-of select='@seq'/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
It still doesn't like the $tabName. VS2005 highlights it as a problem in the editor before i run it!
Regards
AngelMalc
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Ok, there are a few changes that you have to make to your XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="tabName"><xsl:text>Tab 2</xsl:text></xsl:variable>
<xsl:template match="Fields">
<table border="3">
<xsl:apply-templates select="BatchParam[@tab=$tabName]">
<xsl:sort select="@Seq" data-type="number"/>
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="BatchParam">
<tr>
<td><xsl:value-of select='position()'/></td>
<td><xsl:value-of select='@tab'/></td>
<td><xsl:value-of select='@name'/></td>
<td><xsl:value-of select='@Seq'/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
The first change is for the value of tabName from "Main" to "Tab 2" so it actually matches something in the XML you provided. The next thing is the statement BatchParam[@tab=$tabName] . Normally you can do this, but the problem is where you placed it. You put it in the select for the template match. You simply can't put variables there. You want that variable to be placed in the call to the template match, not in the declaration of the template match. Also, your select of @seq wasn't returning anything because the XML you provided was using Seq as the attribute. So be careful of the case sensitivity. Also, be sure to specify the "number" data type when sorting otherwise you can get something like 1, 10, 11, 12, 2, 3, etc.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hero. Many thanks. The 'Main' bit was a typo, the code I pasted wasn't the code I am working on (not allowed....).
I appreciate your help, and looking at the number of posts on here, a lot of others appreciate your help as well!!
Regards
Malc
*********************************************
|
|
|
|
|
And for completeness, I swapped the xsl:variable for a xsl:param and in the code used XsltArgumentsList to populate it from the client - and it works a treat.
Thanks again
Regards
Malc
*********************************************
|
|
|
|
|
Awesome. Glad to hear everything's working out. Although I am starting to feel like an XSL/XPath *cough*expert*cough*. Not sure if that's a good thing.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hello There
can any one mail me or post me a link for complete reference on Xpath ?
rbashir@alm-soft.com
|
|
|
|
|
|
Consider this xml:
<br />
<rrx id="someother">...</rrx><br />
<rrx id="Zones"><br />
<f name="NM"><br />
<p name="xoxoxo"/><br />
</f><br />
<s name="GB"><br />
<p name="xexexe"/><br />
<p name="xaxaxa"/><br />
</s><br />
<a name="SP"><br />
<p name="hmhmhm"/><br />
</a><br />
<b name="Alien"><br />
<p name="opsops"/><br />
</b><br />
</rrx><br />
I need to select all "p" elements in "f","s" or "a" with a given "name" but not "b" which are in "rrx" with particular "id". So I'm trying to come up with or statement for f,s,a in the middle of XPath.
Using XSLT 2.0 and Xpath 2.0 this works fine:
//rrx[@id='Zones']/(f|s|a)[@name='GB']/p - I should get xexexe and xaxaxa and if
//rrx[@id='Zones']/(f|s|a)[@name='SP']/p - I need hmhmhm
But good old 1.0 says it's invalid. That () are not allowed there. How else would the XPath then look?
|
|
|
|
|
The feature you try to use is new to XPath 2.0
One of the ways you could solve it in XPath 1.0 would be:
instead of:
//rrx[@id='Zones']/(f|s|a)[@name='SP']/p
write:
//p[(parent::f[(@name='SP')and(parent::rrx[@id='Zones'])]) or (parent::s[(@name='SP')and(parent::rrx[@id='Zones'])]) or (parent::a)[(@name='SP')and(parent::rrx[@id='Zones'])]]
It does not look nice, but would be an example.
|
|
|
|
|
Hi all,
how would i set the page width in xsl to 80mm?
i want to create a template for a slip printer....
He who laughs last...
|
|
|
|
|
Okay thanks anyways, i'll just use a table and set it according.
Sorry, i thought of it a i posted the message.
He who laughs last...
|
|
|
|
|
Sorry, the table idea didn't work. is it possible to set the page width, because if i try to print now, through the slip printer, it prints it fine but i keeps spitting out paper... my friend suggested that it could be because the xsl is using an A4 and the slip is only 80mm in width, actually 79.5mm, and it is not working correctly because of this...
Please help
He who laughs last...
|
|
|
|