|
The XPath 'Results/child::node()[1]/child::node()[2]' selects the second child 'child::node()[2]' of the first child 'child::node()[1]' of the element 'Results'. The '[2]' actually means 'position() = 2'. You can kind of think of '[2]' as an array index, where the base is 1.
I have learned XSLT from the first edition of this book:
XSLT Programmer's Reference, Second Edition
by Michael Kay
Wrox Press © 2001 (938 pages)
ISBN:0764543814
There is also a third edition the covers XSLT 2.0:
XSLT 2.0 Programmer's Reference, Third Edition
by Michael Kay
Wrox Press © 2004 (955 pages)
They have a tutorial/reference type structure which makes them useful for some time.
I also found the following useful also:
XSLT Cookbook, Second Edition
by Sal Mangamo
O'Reilly Media,Inc. © 2006 (751 pages)
ISBN: 0-596-00974-7
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks very much u know I really appreciate this. I'll try and get hold of these books!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Alternative:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Call Sequence</title>
</head>
<body>
<xsl:apply-templates select="CallSequence/Call/Arguments"/>
</body>
</html>
</xsl:template>
<xsl:template match="Arguments">
<table>
<tr>
<xsl:apply-templates select="*"/>
</tr>
</table>
</xsl:template>
<xsl:template match="*">
<th><xsl:value-of select="name()"/></th>
</xsl:template>
<xsl:template match="Results">
<xsl:apply-templates select="*[1] | *[1]/Value"/>
</xsl:template>
</xsl:stylesheet>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
i'd would like to add that line <?xml-stylesheet type=\"text/xsl\" href=\"{0}\"?>
to my xml file using the xmlDocument-Class but i don't know how? Atm i use the following code
using (XmlWriter writer = XmlWriter.Create(FullFilePath, settings))
{
writer.WriteRaw(string.Format("<?xml-stylesheet type=\"text/xsl\" href=\"{0}\"?>", Globals.StylesheetXSL));
writer.WriteStartElement("root");
writer.WriteEndElement();
writer.Flush();
writer.Close();
}
-- modified at 10:49 Thursday 30th August, 2007
|
|
|
|
|
error1408 wrote: using the xmlDocument-Class
error1408 wrote: using (XmlWriter writer = XmlWriter.Create(FullFilePath, settings))
XmlWriter is NOT XmlDocument. I strongly recommend you use the documentation[^] to find information.
|
|
|
|
|
I KNOW, that is the code I use at the moment...
I do not know how to do exactly the same with the xmlDocument-Class. Thats why i'm asking.
|
|
|
|
|
error1408 wrote: I do not know how to do exactly the same with the xmlDocument-Class.
I fail to see how that negates my original reply... I strongly recommend you use the documentation to find information.
|
|
|
|
|
I searched the documentation for my problem. And i found nothing. I checked every method.
And because i found nothing, i asked you.
|
|
|
|
|
error1408 wrote: I searched the documentation for my problem. And i found nothing.
You should probably provide that information in your initial post.
error1408 wrote: I checked every method.
I guess you missed this one[^]
|
|
|
|
|
THANK YOU. You're the man! Why didn't i see it before? At last the ugly code can be banished! Hurray
led mike wrote: You should probably provide that information in your initial post.
Yes perhaps
|
|
|
|
|
I wonder why Microsoft keeps hiding this information in the documentation?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Yeah and Google is culpable as well since they provide a perfectly usable Search Engine.
|
|
|
|
|
I'm trying to create ASPX page with DataGrid, that includes template column, which looks like TextBox. I order to enable data binding to textbox I'm using the following syntax:
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' ID="txtID" /> using XSL.
I supposed, the XSL code should be the same, while escaping '<','>' etc.:
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' ID="txtID" />.
In this case I'm getting the following error:
Parser Error Message: Code blocks are not supported in this page, because it is not compiled.
Please, assist.
Alex
-- modified at 10:06 Wednesday 29th August, 2007
|
|
|
|
|
It is objecting to the "<%# ... %>" code which gets placed in the .aspx page before it gets compiled. By the time you place your code in the page, the page has already been compiled. Also, why place a textbox in this way when you can do it statically in design mode?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Is there any workaround? Is it possible to implement this in code-behind file?
|
|
|
|
|
There are a some ways but you have to stay away from the code blocks. You may need to as your question in the ASP.NET Forum to get a better answer, but you can use XSL in the creation of a custom control or during the binding processs you can add content to a cell or even modify the whole row. However, you have to stay away from coding blocks.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks anyway
|
|
|
|
|
how to create a xml document from a given xpath
Keshav Kamat
India
|
|
|
|
|
What do you mean? XPath is just a query. If you are talking about the resulting sequence or node set from an executed XPath query, what programming or mark-up language are you using?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I am trying to put a ":" inside the XML tags. e.g.
<cnn:data>
right now it is this way:
<cnn_x0020_data>
|
|
|
|
|
The ":" is used to add a namespace to an element, for example: <xsl:element/> , where xsl is the namespace. If you are not using ":" for this reason, it should not be embedded in an element.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I'm building a schema to define data transfer tasks, the first being an export to a flat file. I'm borrowing lightly from RDL, and in my DataExport element I have DataSources and DataSets elements. Then I have an Output element that contains Sections, and each Section element has a Record element consisting of several Field elements.
Now my issue is that I have two different type Field elements, one for input fields and one for output fields. The output fields have several extra attributes such as maxWidth, format, etc. and they need a link to an input field. I would like to define one single Field element, but use child elements to differentiate between input and output fields etc. I'm thinking of placing e.g. format data into a new Format element that I could add to a Field element when it is an output field.
Suggestions, recommendations, criticism etc. are all welcome.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Add an attribute to your single Field element that will determine its type:
...
<io type="input">
<!-- child input elements -->
</io>
<io type="output">
<!-- child output elements -->
</io>
...
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks, I like that idea, but I've decided to go with a single collection of Field elements, all being output fields. The data source already provides input fields, so while RDL uses the extra indirection of mapping a set of report fields to data source fields, and then report elements, like textbox, to report fields, I don't need that. My 'report fields' are my output fields.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Hi Friends,
I am working on Javascript and I have some XML data in an object. Now I want to show that data using document.writeline() as it is.
means
I want to show the XML with all its node tags.
Please give me solution.
Thanks in advance.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|