|
hi,
I don't see how you could directly transform XML data to image with XSL... XSL is not meant for binary output IMHO, and images are binary format. What kind of data it is? You can transform them to SVG for example ( http://www.w3.org/Graphics/SVG/[^] ), which is XML->XML transformation. Are you sure this is best approarch (I mean transformation)? You could process XML in application and using some drawing API ( like GDI+ ) create desired image. Maybe you'll have to include more information so I can help more.
David
|
|
|
|
|
Sorry, did not mean to leave it so open ended. BAsically what I would like to do is transform the xml using the xsl and convert the output into a tiff using c# or vb.net or any technology that can facilitate this requirement. I know in .Net you can convert text into tiff using the System.Drawing and System.Drawing.Image classes. Hope this helps clarify a bit, any help would be greatly appreciated.
|
|
|
|
|
You answered yourself. If you have XML, say <circle radius="10px" color="red" x="50" y="100" /> , you just parse it with classes from System.Xml , and then use GDI+ ( System.Drawing ) to draw that circle. AFAIK there is no "native" XML-based format for GDI+ (WMF maybe, but that again isn't text format, but binary one).
David
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Unfortunatley, it is a little more complicated than that. The XML is all text and the XSL is the layout for an Invoice which includes text, html and images. I have never used System.Drawing and new to .Net generally. Is there perhaps someway to convert the transformation output to binary and feed the binary stream to one of the System.Drawing classes?
|
|
|
|
|
I think I am finnaly understanding the problem. You don't need to output image from XSLT transformation, but you need to save that output (HTML with images etc.) as image, right? I think your best bet is 3rd party component... I don't know any way (not to mention easy way) how to convert HTML to TIFF image.
David
|
|
|
|
|
Exactly! I tend to agree, I cant find anything online (code) that is not a third party product. I have even tried converting the html output to binary then to tiff or bmp with not much success. Thanks for all our help, if I figure out a way, I will post it out for others to use...
|
|
|
|
|
hi,
I am facing a problem of inserting two sheets in an excel workbook as well as corresponding data in it using XML/HTML.
please tell me whether this can be done and if yes then can I have a sample code for the same.
thanks.
Abhinav
|
|
|
|
|
First modify your post and check "Do not treat <'s as HTML tags", then tell us HOW you tried to change text of node, and WHY you were unable to do it, possibly show what EXACTLY error message say.
thanks
David
|
|
|
|
|
am using datasets to write an xml output file. one of the requirements, is to "nest" within a "nested" element.
I was writing out using
With ds.Tables("Account")
.Columns("stateacctrecordid").ColumnMapping = MappingType.Element
<<<< NEED to Nest another data set at this Point>>>>
.Columns("businessname").ColumnMapping = MappingType.Element
.Columns("businesstype").ColumnMapping = MappingType.Element
.Columns("operationtype").ColumnMapping = MappingType.Element
.Columns("county").ColumnMapping = MappingType.Hidden
.Columns("Active").ColumnMapping = MappingType.Hidden
End With
But now within this nest I need to nest another data set after the column "Stateacctrecordid"
Any Ideas would be helpful
sparty1022
|
|
|
|
|
Hi All
Export to excel data from ultrawebgrid rows, Each data row contain one worksheet in excel sheet like as
row1 data contain sheet1
row2 data contain sheet2
row3 data contain sheet3
this opertaion getting at a time on pressing one button.
we have pressing one button ultrawebgrid rows data to export excel sheet, In excel sheet each worksheet contain one grid row deatails, for example grid have 10 rows ,pressing any button, In excel sheet 10 worksheets will occure and each worksheet contain 1 row data of grid pls send me a solution for this example
|
|
|
|
|
I am looking to edit an XSLT that has 2 nested for-each calls in order to group items based on the value of a subnode of each item.
The innnermost for-next processes each item for html display. I'm using choos-when-otherwise combo to check the position() for the current group. If the position = 1 it is displayed differently than the other items.
What I'd like to do is put the first item contents into an HTML table row and then put ALL of the remaining items for the current group into the next table row.
My problem is I can't put <tr> or <td> tags into the xsl:otherwise node because they are inserted for every item, and I can't seem to put the html tags outside the xsl:otherwise section or use conditions (position=2) because then the html tags don't match up and the xslt document won't validate.
I'm new to XSL and must be missing something... ideas anyone?
==================================================
<xsl:key name="items-by-category" match="item" use="category" />
<xsl:template match="rss/channel">
<xsl:for-each select="item[count(. | key('items-by-category', category)[1]) = 1]">
<xsl:for-each select="key('items-by-category', category)">
<xsl:choose>
<xsl:when test="position() = 1">
<tr><td>item output format style 1</td></tr>
</xsl:when>
<xsl:otherwise>
item output format style 2 - includes all remaining items in the group
but I want to put all of these into a single TD as above, not each one in a separate TD?
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
======================================================
Lefty
|
|
|
|
|
hi, you probably have to use <xsl:value-of select="<td>" > etc., you can't have malformed HTML literaly in XSLT.
ps. I write this from head so sintax is probably wrong, but I hope you get the idea.
David
|
|
|
|
|
Hi
I want to delete node from xml file
this is example of xml file
<audit_list>
<control_type>xxx
<control_group group="xxx1">
<control_sub_group sub_group="yyy1">
<activity>
<control_activity>zzzz</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_sub_group sub_group="xxx2">
<activity>
<control_activity>ccccc</control_activity>
<comment>medium</comment>
</activity>
<activity>
<control_activity>bbbb</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_group group = "xxx2">
<control_sub_grop sub_group = "">
.....
this is my command to delete node but I get some error that I can't solv
please help me?
I want to delete node <activity> which have text of <control_activity> = ........ (get from user)
Dim listname As String
If rdo_type1.Checked Then
listname = "audit_list.xml"
ElseIf rdo_type2.Checked Then
listname = "audit_list_application.xml"
End If
'==============
Dim objdomdocument, objxmldomnode, objelement, strxpath, objCurrNode
objdomdocument = CreateObject("Microsoft.XMLDOM")
objdomdocument.async = False
objdomdocument.load(Server.MapPath(listname))
'==========
objCurrNode = objdomdocument.documentelement.firstchild
'==========
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']/control_activity/activity"
objelement = objdomdocument.selectSingleNode(strxpath)
Dim i As Integer
Dim t_attribute As String
Dim x_text As String
Dim j As Integer
Dim x_nodelist
Dim a As Integer
For i = 1 To 50
t_attribute = objCurrNode.childnodes(i).getattribute("group")
If t_attribute = lst_group.SelectedItem.Text.ToString() Then
objCurrNode = objCurrNode.childnodes(i)
For j = 1 To 50
x_nodelist = objCurrNode.childnodes(j).getelementsbytagname("control_activity")
For a = 0 To x_nodelist.length
x_text = x_nodelist.item(a).firstchild.nodevalue
If x_text = lst_activity.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(j).childnodes.item(a).removechild(objelement)
Exit For
End If
Next
Next
End If
Next
objdomdocument.save(Server.MapPath(listname))
thank you.
|
|
|
|
|
If you find a node you want to remove, then you need to do theNode.ParentNode.RemoveChild(theNode). Something like that, the syntax is not exactly right.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
plase suggest me more, I don't understand
I can remove node <control_sub_group> by using command below
Dim listname As String
If rdo_type1.Checked Then
listname = "audit_list.xml"
ElseIf rdo_type2.Checked Then
listname = "audit_list_application.xml"
End If
'==============
Dim objdomdocument, objxmldomnode, objelement, strxpath, objCurrNode
objdomdocument = CreateObject("Microsoft.XMLDOM")
objdomdocument.async = False
objdomdocument.load(Server.MapPath(listname))
objCurrNode = objdomdocument.documentelement.firstchild
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']"
objelement = objdomdocument.selectSingleNode(strxpath)
Dim i As Integer
Dim t_attribute As String
For i = 1 To 50
t_attribute = objCurrNode.childnodes(i).getattribute("group")
If t_attribute = lst_group.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(i).removechild(objelement)
Exit For
End If
Next
objdomdocument.save(Server.MapPath(listname))
I think command strxpath = ....... it can get me a node <control_sub_group>
but now I want to delete node <activity> that use <control_activity> to be condition
I'm not sure if I want to delete node <activity> I can use strxpath or not/
or I should use another command?
please revise my syntax or suggest me more
thank you
|
|
|
|
|
Ah.. maybe you need to remove the inner child nodes before you can remove a node that has children of it's own ?
I was saying that if you use an XPath to find the actual node you want to remove, you can remove a node using itself as the point of reference, because there is a ParentNode property you can use to get the node one higher than the one you're at. That way, you don't have to search for nodes based on the node you want to remove being a child, but just search for the node you want.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
command ---
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']"
objelement = objdomdocument.selectSingleNode(strxpath)
command above I can use parentchild.removechild(objelement) but
command ---
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']/activity/control_activity"
this command not specific activity that I want to delete the activity node that i want to delete it depend on control_activity.value
this command how can i specific node activity that have node <control_activity> xxxx </control_activity>
I'm not sure do you understand my problem,I'm sorry if I make you confuse
Thank you.
|
|
|
|
|
I admit that I am unlikely to read carefully the huge amount of code you posted. If you're wanting to remove based on the parent node, then you don't need what I suggested.
Perhaps if you explained what error you are getting, it would be easier to help you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
error message is
" Object variable or with block variable not set "
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vamsgobjnotset.asp[^]
On to your code:
For j = 1 To 50
Why 50 ? Are VB arrays 1 based ? ( Nothing would surprise me ). This will give you an error if you have less than 50 elements, and not search them all if you have more
x_nodelist = objCurrNode.childnodes(j).getelementsbytagname("control_activity")
For a = 0 To x_nodelist.length
x_text = x_nodelist.item(a).firstchild.nodevalue
If you look at your schema, control_activity does not have any child nodes, which is why this blows up, with the error you describe.
If x_text = lst_activity.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(j).childnodes.item(a).removechild(objelement)
and therefore, it won't even get this far.
Exit For
End If
Next
Next
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you very much for your kindness, but I still can't solve my problem
|
|
|
|
|
Hi - I was just looking at your x-path - -
audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']/control_activity/activity
1) I notice that: you have "activity" as child of "control-activity" while your xml is the other way around: "control-activity" is the child of "activity".
2) if this is corrected - then to remove the activity node:
Something like this:
//first get all the nodes that have control-activity = to user input
dim contActNodes, contActNode, actNode
contActNodes=objdomdocument.selectNodes("//control-activity[.='user-input']")
for each contActNode in contActNodes
//parent node of control-activity is activity
actNode = contActNode.ParentNode
//to remove activity, you need to get to the parent of activity
actNode.PerentNode.RemoveChild(actNode)
next
|
|
|
|
|
I have a XML file eg
<Root>
<Data>SomeData</Data>
<Data>More ...<Data>
</Root>
I now need to add another Data Item , I'm using XmlTextWriter.
How can I open the file without parsing the XML and add another Data item ?
and avoid having multiple root items.
Im using Windows CE so XMLDoc is too expensive, and I would like to avoid seeking through the stream to find </Root>
Thanks
.n<strike>u</strike>etter
|
|
|
|
|
|
Thanks, thought of using a seperate file, thats what I will do, but its ugly.
.nuetter
|
|
|
|