|
Some thoughts as not sure what you are working with: Just use the ID of the parent element and don't bother to assign children ID's. If you are doing a LINQ query and target the parent element with the ID you are looking for your "result" will be the element along with its children which will have the "same ID" whether it is physically assigned or not. I also would guess that you are somehow programmatically creating the XML, adding to it occasionally or subtracting to update it. So, when you create a new element to add to your XML, include all children ID attributes at the time of creation. Hope that helps.
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
|
|
|
|
|
What I want to do is import this into Access and query the tables. The problem is Access is picky about it and makes a table for everything so I need to be able to match the records. I have no control over creating the xml document but it is generated by a system.
modified 28-Mar-16 11:01am.
|
|
|
|
|
OK, I'm guessing from that - you are not a developer? 2 ideas: Try importing into Excel. I've been able to work with XML files successfully there. Then you should be able to tweak it there. Easiest way would be to install Visual Studio latest free version and write a short query.
P.S. The following code will do pretty much what you are saying in a Visual Basic Console Application:
Dim myXMLFileLocation As String = ""
Dim myXmlFile As XElement = XElement.Load(myXMLFileLocation)
For Each ele In myXmlFile.Elements
For Each child In ele.Descendants
child.SetAttributeValue("type", ele.@type)
Next
Next
Console.WriteLine(myXmlFile.ToString)
Console.ReadLine()
myXmlFile.Save(myXMLFileLocation)
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
modified 29-Mar-16 2:10am.
|
|
|
|
|
Thank you Jim for your help but I think I solved the problem. I am a programmer and believe me I would have had this done in C# or VB sprinkle in some LINQ in less than an hour if I had my way. Loading it into Excel does work and is a valid solution, I just wanted to try to solve it with XSLT. I also need to automate this for everyday mail merges so Access is a nice easy solution for the company I work for. So below is my code:
="1.0"="utf-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<dataroot>
<xsl:apply-templates select="@*|node()"/>
</dataroot>
</xsl:template>
<xsl:template match="envelope">
<xsl:copy>
<xsl:element name="id">
<xsl:value-of select="generate-id(.)"/>
</xsl:element>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="prev_id" select="generate-id()"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="person">
<xsl:param name="prev_id"/>
<xsl:copy>
<xsl:variable name="cur_id">
<xsl:value-of select="$prev_id"/>/>
</xsl:variable>
<xsl:element name="id"><xsl:value-of select="$cur_id"/></xsl:element>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="prev_id" select="$cur_id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="contact">
<xsl:param name="prev_id"/>
<xsl:copy>
<xsl:variable name="cur_id">
<xsl:value-of select="$prev_id"/>/>
</xsl:variable>
<xsl:element name="id"><xsl:value-of select="$cur_id"/></xsl:element>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="prev_id" select="$cur_id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="address">
<xsl:param name="prev_id"/>
<xsl:copy>
<xsl:variable name="cur_id">
<xsl:value-of select="$prev_id"/>/>
</xsl:variable>
<xsl:element name="id"><xsl:value-of select="$cur_id"/></xsl:element>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="prev_id" select="$cur_id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="notice">
<xsl:param name="prev_id"/>
<xsl:copy>
<xsl:variable name="cur_id">
<xsl:value-of select="$prev_id"/>/>
</xsl:variable>
<xsl:element name="id"><xsl:value-of select="$cur_id"/></xsl:element>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="prev_id" select="$cur_id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
Good on solving it. I didn't realize you were trying to solve it with XSLT I didn't look as I thought it would be a "display" stylesheet...
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
|
|
|
|
|
2. Document Content is determined by
a) Stylistic Markup c) Structural Markup
b) Semantic Markup
|
|
|
|
|
|
When I try to convert the string containing DLE "#10;" in XML DOM, it throws "XML parsing" error.
I am not sure why it is being rejected by XML parser.
|
|
|
|
|
|
First, what i say here is an expression of my personal opinion and not that of any entity or organization or persons that I am associated with.
With that said. &^^%***& ^%$%&&* *^$#$$^&*& ***&^%^!!!!!!
I'm am a novice or part-time coder that wants to make some change to a product we purchased and the layouts suck.
Here is the Code. What I want to do is change the Binding attributes to better suit my project teams aesthetics. Will anyone help me with this.
?xml version="1.0" encoding="ISO-8859-1"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:bind="http://www.managedobjects.com/bind" background="true" bind:setup="1157586251614" ontentScriptType="text/ecmascript" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" dname="org=NS-IT/layout_hierarchical=Norfolk+Southern+Models/root=Organizations" version="1.1" width="112.90234375" dname_relid="1" MOS_viewBox="-10 -8 132 60" preserveAspectRatio="xMidYMid meet" templatename="graphic=default/graphicsFolder=Templates/graphics=Graphics/root=Administration" height="40.0" MOS_Scale="1.0" x="-3" overflow="visible" y="-1">
<bind:children id="1" depth="1">
<bind:layout routingStyle="1" id="2" marker-end="url(Static__statics#Arrow2Mend)"/>
<bind:connect from="#1_7192" id="1_1_7192_1_705249_nam" help="NS-IT--CTA (Critical Transportion Application)" to="#1_705249" bind:marks="generated,grouped"/>
<bind:connect from="#1_7192" id="1_1_7192_1_705270_nam" help="NS-IT--KPI" to="#1_705270" bind:marks="generated,grouped"/>
<bind:connect from="#1_7192" id="1_1_7192_1_705271_nam" help="NS-IT--Non-CTA" to="#1_705271" bind:marks="generated,grouped"/>
<bind:connect from="#1_7192" id="1_1_7192_1_705272_nam" help="NS-IT--System Applications" to="#1_705272" bind:marks="generated,grouped"/>
</bind:children>
<g bind:connectiongroup="2" bind:marks="generated" gpath="1" class="connectors" id="2polyGroup" stroke="black" stroke-width="1.5">
<path fill="none" bind:marks="generated" bind:group="1_1_7192_1_705249_nam" gpath="1" d="M 4 18 L 4 52 Q 4 58 10 58 L 238 58 Q 244 58 244 64 L 244 78 " marker-end="url(Static__statics#Arrow2Mend)" bind:connect="1_1_7192_1_705249_nam"/>
<path fill="none" bind:marks="generated" bind:group="1_1_7192_1_705270_nam" gpath="1" d="M 4 18 L 4 192 Q 4 198 10 198 L 247 198 Q 253 198 253 204 L 253 218 " marker-end="url(Static__statics#Arrow2Mend)" bind:connect="1_1_7192_1_705270_nam"/>
<path fill="none" bind:marks="generated" bind:group="1_1_7192_1_705271_nam" gpath="1" d="M 4 18 L 4 192 Q 4 198 10 198 L 110 198 Q 116 198 116 204 L 116 218 " marker-end="url(Static__statics#Arrow2Mend)" bind:connect="1_1_7192_1_705271_nam"/>
<path fill="none" bind:marks="generated" bind:group="1_1_7192_1_705272_nam" gpath="1" d="M 4 18 L 4 122 Q 4 128 10 128 L 158 128 Q 164 128 164 134 L 164 148 " marker-end="url(Static__statics#Arrow2Mend)" bind:connect="1_1_7192_1_705272_nam"/>
</g>
<g transform="matrix(1, 0, 0, 1, 40.091796875, 79)" gpath="1" dname="gen_folder=CTA+%28Critical+Transportion+Application%29/.." gautolayout="2" id="1_705249" ghash="670c6296" bind:graphicsource="system">
<svg bind:setup="1153776504367" MOS_PanX="465" contentScriptType="text/ecmascript" zoomAndPan="magnify" MOS_PanY="442" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" version="1.1" width="208.154296875" ghash="670c6296" dname_relid="1" MOS_viewBox="-18 -9 228 60" preserveAspectRatio="xMidYMid meet" viewBox="-8.0 1.0 208.154296875 40.0" height="40.0" MOS_World="1" xmlns="http://www.w3.org/2000/svg" MOS_Scale="1.0" xmlns:bind="http://www.managedobjects.com/bind" overflow="visible">
<g>
<rect x="-7.0" y="2.0" fill="url(#linear_conditiongradient_ffffffff_ff80ff80_0_0_0_1)" width="408.49805" bind:group="false" rx="5" height="38.0" bind:container="true" ry="5" stroke="black" stroke-width="2">
<bind:value prefix="Static__statics#horizontal_linear_condition_" attr="fill" property="conditiongradient"/>
</rect>
<bind:layout name="wrap" id=".g.14c5bc63922" ypad="3" xpad="12"/>
<use x="5" y="5" width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#3c7612e1a776d712ca2d667d53143bf555b43" xlink:type="simple" gautolayout=".g.14c5bc63922" xlink:actuate="onLoad" height="32" xlink:show="embed">
<bind:image bind:setup="1157586251614"/>
</use>
<text x="50" font-size="20px" y="30" transform="matrix( 1, 0, 0, 1, -1, 0)" fill="rgb(0,0,0)" text-anchor="start" font-family="helvetica" gautolayout=".g.14c5bc63922" stroke="none" xml:space="default">CTA (Critical Transportion Application)<bind:value property="name"/><bind:fill property="conditionforeground"/></text>
<symbol preserveAspectRatio="xMidYMid meet">
<rect height="32" width="32"/>
</symbol>
</g>
</svg>
</g>
<g transform="matrix(1, 0, 0, 1, 203.4739532470703, 219)" gpath="1" dname="gen_folder=KPI/.." gautolayout="2" id="1_705270" ghash="670c6296" bind:graphicsource="system">
<svg bind:setup="1153776504367" MOS_PanX="465" contentScriptType="text/ecmascript" zoomAndPan="magnify" MOS_PanY="442" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" version="1.1" width="208.154296875" ghash="670c6296" dname_relid="1" MOS_viewBox="-18 -9 228 60" preserveAspectRatio="xMidYMid meet" viewBox="-8.0 1.0 208.154296875 40.0" height="40.0" MOS_World="1" xmlns="http://www.w3.org/2000/svg" MOS_Scale="1.0" xmlns:bind="http://www.managedobjects.com/bind" overflow="visible">
<g>
<rect x="-7.0" y="2.0" fill="url(#linear_conditiongradient_ffffffff_ff808080_0_0_0_1)" width="98.44271" bind:group="false" rx="5" height="38.0" bind:container="true" ry="5" stroke="black" stroke-width="2">
<bind:value prefix="Static__statics#horizontal_linear_condition_" attr="fill" property="conditiongradient"/>
</rect>
<bind:layout name="wrap" id=".g.14c5bc63923" ypad="3" xpad="12"/>
<use x="5" y="5" width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#3c7612e1a776d712ca2d667d53143bf555b43" xlink:type="simple" gautolayout=".g.14c5bc63923" xlink:actuate="onLoad" height="32" xlink:show="embed">
<bind:image bind:setup="1157586251614"/>
</use>
<text x="50" font-size="20px" y="30" transform="matrix( 1, 0, 0, 1, -1, 0)" fill="rgb(255,255,255)" text-anchor="start" font-family="helvetica" gautolayout=".g.14c5bc63923" stroke="none" xml:space="default">KPI<bind:value property="name"/><bind:fill property="conditionforeground"/></text>
<symbol preserveAspectRatio="xMidYMid meet">
<rect height="32" width="32"/>
</symbol>
</g>
</svg>
</g>
<g transform="matrix(1, 0, 0, 1, 40.091796875, 219)" gpath="1" dname="gen_folder=Non-CTA/.." gautolayout="2" id="1_705271" ghash="670c6296" bind:graphicsource="system">
<svg bind:setup="1153776504367" MOS_PanX="465" contentScriptType="text/ecmascript" zoomAndPan="magnify" MOS_PanY="442" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" version="1.1" width="208.154296875" ghash="670c6296" dname_relid="1" MOS_viewBox="-18 -9 228 60" preserveAspectRatio="xMidYMid meet" viewBox="-8.0 1.0 208.154296875 40.0" height="40.0" MOS_World="1" xmlns="http://www.w3.org/2000/svg" MOS_Scale="1.0" xmlns:bind="http://www.managedobjects.com/bind" overflow="visible">
<g>
<rect x="-7.0" y="2.0" fill="url(#linear_conditiongradient_ffffffff_ff808080_0_0_0_1)" width="151.38216" bind:group="false" rx="5" height="38.0" bind:container="true" ry="5" stroke="black" stroke-width="2">
<bind:value prefix="Static__statics#horizontal_linear_condition_" attr="fill" property="conditiongradient"/>
</rect>
<bind:layout name="wrap" id=".g.14c5bc63924" ypad="3" xpad="12"/>
<use x="5" y="5" width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#3c7612e1a776d712ca2d667d53143bf555b43" xlink:type="simple" gautolayout=".g.14c5bc63924" xlink:actuate="onLoad" height="32" xlink:show="embed">
<bind:image bind:setup="1157586251614"/>
</use>
<text x="50" font-size="20px" y="30" transform="matrix( 1, 0, 0, 1, -1, 0)" fill="rgb(255,255,255)" text-anchor="start" font-family="helvetica" gautolayout=".g.14c5bc63924" stroke="none" xml:space="default">Non-CTA<bind:value property="name"/><bind:fill property="conditionforeground"/></text>
<symbol preserveAspectRatio="xMidYMid meet">
<rect height="32" width="32"/>
</symbol>
</g>
</svg>
</g>
<g transform="matrix(1, 0, 0, 1, 40.091796875, 149)" gpath="1" dname="gen_folder=System+Applications/.." gautolayout="2" id="1_705272" ghash="670c6296" bind:graphicsource="system">
<svg bind:setup="1153776504367" MOS_PanX="465" contentScriptType="text/ecmascript" zoomAndPan="magnify" MOS_PanY="442" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" version="1.1" width="208.154296875" ghash="670c6296" dname_relid="1" MOS_viewBox="-18 -9 228 60" preserveAspectRatio="xMidYMid meet" viewBox="-8.0 1.0 208.154296875 40.0" height="40.0" MOS_World="1" xmlns="http://www.w3.org/2000/svg" MOS_Scale="1.0" xmlns:bind="http://www.managedobjects.com/bind" overflow="visible">
<g>
<rect x="-7.0" y="2.0" fill="url(#linear_conditiongradient_ffffffff_ff808080_0_0_0_1)" width="247.30989" bind:group="false" rx="5" height="38.0" bind:container="true" ry="5" stroke="black" stroke-width="2">
<bind:value prefix="Static__statics#horizontal_linear_condition_" attr="fill" property="conditiongradient"/>
</rect>
<bind:layout name="wrap" id=".g.14c5bc63925" ypad="3" xpad="12"/>
<use x="5" y="5" width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#3c7612e1a776d712ca2d667d53143bf555b43" xlink:type="simple" gautolayout=".g.14c5bc63925" xlink:actuate="onLoad" height="32" xlink:show="embed">
<bind:image bind:setup="1157586251614"/>
</use>
<text x="50" font-size="20px" y="30" transform="matrix( 1, 0, 0, 1, -1, 0)" fill="rgb(255,255,255)" text-anchor="start" font-family="helvetica" gautolayout=".g.14c5bc63925" stroke="none" xml:space="default">System Applications<bind:value property="name"/><bind:fill property="conditionforeground"/></text>
<symbol preserveAspectRatio="xMidYMid meet">
<rect height="32" width="32"/>
</symbol>
</g>
</svg>
</g>
<g transform="matrix(1, 0, 0, 1, 0.091796875, -1)" gpath="1" dname="." gautolayout="2" id="1_7192" ghash="670c6296" bind:graphicsource="system">
<svg bind:setup="1153776504367" MOS_PanX="465" contentScriptType="text/ecmascript" zoomAndPan="magnify" MOS_PanY="442" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" version="1.1" width="208.154296875" ghash="670c6296" dname_relid="1" MOS_viewBox="-18 -9 228 60" preserveAspectRatio="xMidYMid meet" viewBox="-8.0 1.0 208.154296875 40.0" height="40.0" MOS_World="1" xmlns="http://www.w3.org/2000/svg" MOS_Scale="1.0" xmlns:bind="http://www.managedobjects.com/bind" overflow="visible">
<g>
<rect x="-7.0" y="2.0" fill="url(#linear_conditiongradient_ffffffff_ff80ff80_0_0_0_1)" width="119.81641" bind:group="false" rx="5" height="38.0" bind:container="true" ry="5" stroke="black" stroke-width="2">
<bind:value prefix="Static__statics#horizontal_linear_condition_" attr="fill" property="conditiongradient"/>
</rect>
<bind:layout name="wrap" id=".g.14c5bc63926" ypad="3" xpad="12"/>
<use x="5" y="5" width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#5d492721f858797b711d593d6357245f5f6352" xlink:type="simple" gautolayout=".g.14c5bc63926" xlink:actuate="onLoad" height="32" xlink:show="embed">
<bind:image bind:setup="1157586251614"/>
</use>
<text x="50" font-size="20px" y="30" transform="matrix( 1, 0, 0, 1, -1, 0)" fill="rgb(0,0,0)" text-anchor="start" font-family="helvetica" gautolayout=".g.14c5bc63926" stroke="none" xml:space="default">NS-IT<bind:value property="name"/><bind:fill property="conditionforeground"/></text>
<symbol preserveAspectRatio="xMidYMid meet">
<rect height="32" width="32"/>
</symbol>
</g>
</svg>
</g>
<defs>
<linearGradient x1="0" xmlns:xlink="http://www.w3.org/1999/xlink" bind:marks="Generated" y1="0" x2="0" y2="1" xlink:type="simple" xlink:actuate="onLoad" id="linear_conditiongradient_ffffffff_ff80ff80_0_0_0_1" xlink:show="other" c1="rgb(255,255,255)" c2="rgb(128,255,128)">
<stop stop-color="rgb(255,255,255)" offset="0%"/>
<stop stop-color="rgb(255,255,255)" offset="5%"/>
<stop stop-color="rgb(128,255,128)" offset="100%"/>
</linearGradient>
<image width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC0klEQVR42u2U6U9T QRTF+Z/6GaNENO77EjWusWpc4q4obqjEiLgFbYUqdKGtpWjCB/4KNyKuuOGGuKSC qCCR470z8/qmzzd9JlrkQyf55b3Mm7nnnJnblpQUR3GMpeH3+0GPvKg1hRNvb68G cJ24pkgTLcRVhEKVhTFhibe1HdOEmdYcA0ACgUBFQUwgna5Sgq0u4ikiScQFdXV7 hYlAYN8/M6GE0g4scZleGmgWWCfxFzgNpBQtGu7ikriaT6g1KZd9SfWd10eIRiIk DPh8PoFmIKk26SQ18RgRVcQcJpIu+/V9tjhGAiYDCRes1FaRsHpGPIzo4mFNPAgM 1ZoMxDWaNeGoEmxShZo0I04T+v5orjhY/AwwcNxkIKYR1RJbwleIy+ppMqLvD6u1 LH4J+HEW+Er/MZlKk4GohzAXalBPk5GIdlpO8RPA54PAh135DETyGGDxes2E00ij tsdaH7TF+w4DH/cAPVtMBvIlr5fFfl4UXSzeOZmYt0w1aKdE34fPA99rgC9HxbFz cvRsBl75TQYMiVmQiw2eooInFTU2PD9YK6EOF3PUaOg7BHyqAN7vUMLrgBergKfL TAYcwpx2+JwU4ObhI+Q79CKzn9LuBnq3AW83icRC+Nly4MkS4PFCkwF11CNBOzEL 9x+xi3IaL7LClLh7DfB8BaVeCnQtBh4tAB7OMxng1Bfkb/UbNU1/lS38bivwZiPw er03zsRdi7LCeDCXmGMwIMTpDgeq5VFyx3IaFn65lpKslEW9oDuWaeeTKAvOBu7P Au7NlNC7u4Gh07J5RMfuzHasEFZ3J4p6waJCcAZwd2oundPEvLsBTs5H3rudUm+g +1st746Pj1N0Tv+9oCtTgI5JwJ1yYqKiXM7xN6rjbiBzQIrzPXLj8N3RfQnXvPl2 GXBrwh8wHrg5DrhRKuF3nuP9HZPNBkYbpwExrMnRZGwZKI7/MX4BofxkgD+oUlUAAAAASUVORK5CYII=" bind:marks="generated" xlink:type="simple" xlink:actuate="onLoad" id="3c7612e1a776d712ca2d667d53143bf555b43" height="32" preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
<linearGradient x1="0" xmlns:xlink="http://www.w3.org/1999/xlink" bind:marks="generated" y1="0" x2="0" y2="1" xlink:type="simple" xlink:actuate="onLoad" id="linear_conditiongradient_ffffffff_ff808080_0_0_0_1" xlink:show="other" c1="rgb(255,255,255)" c2="rgb(128,128,128)">
<stop stop-color="rgb(255,255,255)" offset="0%"/>
<stop stop-color="rgb(255,255,255)" offset="5%"/>
<stop stop-color="rgb(128,128,128)" offset="100%"/>
</linearGradient>
<image width="32" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABR0lEQVR42u1VvUoD QRgcUAJaWIioiKYQDCLoY8UujZ0vYKEPoE3A1sqYQgNaqVgoxEBU/EllEWMwIBIU LcZv9QI2OffL7WLhDgzH7s7NDNzPBwQEBNiBWmY3zui0wBzJhYjzQrOeFc4I08JR 4aAQj20/BSbFfEporhPCEeGwcEiYMsHtd6LWIvZu/RQYkJA+E/T6QdRfiMsmUa4T J/dE6Y7YuiDyZWLtyE8B3DwR+zVi85xYPSaWD4ilEpHbJRaLRLYYXQueCvzxS4jI 8Mu4Q4u1+3DtnpfwXvadhic5cxLu4jxRuEtNzze51sV960m0Gk8wI7/aaeFY5//e vbmtVuMJjkcDpt8IzWCJKWCp1Xjiu+HzG1F5ILavYgtYajWe8myqDWLnmlg/JVYO YwtYajWeqqFiq9UNqp+D5LehYqvVeAYE/E98AkleYaRoM61rAAAAAElFTkSuQmCC " bind:marks="generated" xlink:type="simple" xlink:actuate="onLoad" id="5d492721f858797b711d593d6357245f5f6352" height="32" preserveAspectRatio="xMidYMid meet" xlink:show="embed"/>
</defs>
</svg>
|
|
|
|
|
You must specify something specific that you need help with. Don't just say "help me with this." Help you with what?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thats a big Xml!!! and it looks like a Scalar Vector Graphic image.
What do you want us to change in it?
For the record, if you dont know how to see this image then you can save it in a file and change the file extension to .svg and then open it in IE.. you will see "NS-IT" written in it.
However, What is your question?!!
|
|
|
|
|
i want copy few attrbute from one node to another node using XSLT stylesheet
test2 attributes are need to copied to test1
e.g
input:
Test1 a1="123" a2="234" a3="567"
Test1
Test2 b11="123" b2="234" b3="567"
Test2
output
input:
Test1 a1="123" a2="234" a3="567" b11="123" b2="234" b3="567"
Test1
Test2 b11="123" b2="234" b3="567"
Test2
|
|
|
|
|
I'm looking for a way to properly set xsl:match="..." or xsl:value-of select="..."
My files are:
test.xsl
="1.0"="Windows-1250"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<h2>SingleRow1</h2>
<table border="1px" bgcolor="yellow">
<tr>
<td><xsl:value-of select="DocumentContent/section['SingleRow1']/row/FieldA"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow1']/row/FieldB"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow1']/row/FieldC"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow1']/row/FieldD"/>
</td>
</tr>
</table>
<br/>
<h2>SingleRow2</h2>
<table border="1px" bgcolor="yellow">
<tr>
<td><xsl:value-of select="DocumentContent/section['SingleRow2']/row/FieldA"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow2']/row/FieldB"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow2']/row/FieldC"/>
</td>
<td><xsl:value-of select="DocumentContent/section['SingleRow2']/row/FieldD"/>
</td>
</tr>
</table>
<h2>MulitRow1</h2>
<table border="1px" bgcolor="lightgreen">
<xsl:for-each select="DocumentContent/section['MultiRow1']/row">
<tr>
<td><xsl:value-of select="Field1"/>
</td>
<td><xsl:value-of select="Field2"/>
</td>
<td><xsl:value-of select="Field3"/>
</td>
<td><xsl:value-of select="Field4"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
test.xml
="1.0"="windows-1250"
="text/xsl"="test.xsl"
<DocumentContent>
<section name="SingleRow1">
<row>
<FieldA>A</FieldA>
<FieldB>B</FieldB>
<FieldC>C</FieldC>
<FieldD>D</FieldD>
</row>
</section>
<section name="SingleRow2">
<row>
<FieldA>E</FieldA>
<FieldB>F</FieldB>
<FieldC>G</FieldC>
<FieldD>H</FieldD>
</row>
</section>
<section name="MultiRow1">
<row>
<Field1>1</Field1>
<Field2>2</Field2>
<Field3>3</Field3>
<Field4>4</Field4>
</row>
<row>
<Field1>5</Field1>
<Field2>6</Field2>
<Field3>7</Field3>
<Field4>8</Field4>
</row>
<row>
<Field1>9</Field1>
<Field2>10</Field2>
<Field3>11</Field3>
<Field4>12</Field4>
</row>
</section>
</DocumentContent>
The result should be:
SingleRow1
A B C D
SingleRow1
E F D H
MultiRow2
1 2 3 4
5 6 7 8
9 10 11 12
but instead of this i get twice
SingleRow1
A B C D
SingleRow2
A B C D
MultiRow1
3 times empty row
1 2 3 4
5 6 7 8
9 10 11 12
|
|
|
|
|
You can't just use the value of an attribute on the node as an indexer into the collection of nodes. You need to specify the attribute name and a comparison operator:
DocumentContent/section[<ins>@name = </ins>'SingleRow1']/row/FieldA
Your current XSL is matching every <section> node, which is why you're getting two blank lines at the start of your <xsl:for-each> block - one for "SingleRow1", and one for "SingleRow2".
="1.0"="Windows-1250"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<h2>SingleRow1</h2>
<table border="1px" bgcolor="yellow">
<tr>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldA"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldB"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldC"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldD"/>
</td>
</tr>
</table>
<br/>
<h2>SingleRow2</h2>
<table border="1px" bgcolor="yellow">
<tr>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldA"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldB"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldC"/>
</td>
<td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldD"/>
</td>
</tr>
</table>
<h2>MulitRow1</h2>
<table border="1px" bgcolor="lightgreen">
<xsl:for-each select="DocumentContent/section[@name = 'MultiRow1']/row">
<tr>
<td><xsl:value-of select="Field1"/>
</td>
<td><xsl:value-of select="Field2"/>
</td>
<td><xsl:value-of select="Field3"/>
</td>
<td><xsl:value-of select="Field4"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, Richard so much
Last few days i was struggle with it
section[@thankyou='thank you']
|
|
|
|
|
Finally tired of the "System.Xml.XmlValidatingReader is obsolete" message, I undertook to replace it with the recommended XmlReader. The obsolescence documentation from MS wasn't much help, but I did manage to create code that compiled, as follows:
string nameSpace = GetSchemaNamespace(_XmlDocumentStream);
XmlTextReader schemaReader = new XmlTextReader(_SchemaStream);
XmlSchemaSet xsc = new XmlSchemaSet();
xsc.Add(nameSpace, schemaReader);
XmlNameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
XmlParserContext parserContext = new XmlParserContext(nt, nsmgr, null, XmlSpace.None);
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
settings.Schemas.Add(xsc);
settings.ValidationEventHandler += new ValidationEventHandler(ValidationEventHandler);
XmlReader reader = XmlReader.Create(_XmlDocumentStream, settings, parserContext);
And then I found these two things I don't understand:
1. First, the Create failed because this attribute in the xsd wasn't defined.
<xs:attribute ref="xml:space"/>
There was no complaint over this from the obsolete class. From the error message, I assume that this line previously covered that definition:
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
What changed such that this is now a fatal error?
2. I removed the references to the above attribute so I could get a reader created and ran our set of unit tests for this process. The next surprise was that the reader doesn't handle validation errors the same as before. (a) Undefined attributes used to be Warnings. Now they are Errors. So what is now considered a warning? (b) It used to continue on from errors, allowing us to compile a list of errors and warnings for the XML being validated. Now, it bails out after the first error and I never get more than one invocation of the ValidationEventHandler. The test case that used to yield 43 errors and 21 warnings now produces a single error (and the test therefore fails). Is there a way to get the former behavior back?
modified 6-Nov-14 13:12pm.
|
|
|
|
|
2) Try adding handlers directly to the reader and see if you get any further; e.g.
XmlSerializer serializer = new XmlSerializer( typeof( ... ) );
serializer.UnknownNode += new XmlNodeEventHandler( serializer_UnknownNode );
serializer.UnknownAttribute += new XmlAttributeEventHandler( serializer_UnknownAttribute );
|
|
|
|
|
I don't see a way to use that suggestion with the parts that I have. The errors of interest are not going to be found by the default serializer; they are schema conformance errors, relating to a specific xsd, and not plain XML errors.
modified 3-Nov-14 14:36pm.
|
|
|
|
|
Hey, Moderator, I now think this would be more appropriate for the XML forum. Do you agree?
|
|
|
|
|
I used Web Browser(html) the "string" to creat XML?
-- modified 12-Oct-14 23:49pm.
|
|
|
|
|
what is your exact question?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
I have some data in Excel which represents structured lists to be imported into a SQL database in an XML format. I am not so familiar with the nuances of XML but I am pretty good with VBA. I need to generate an XML file that looks like this.
="1.0"
<!DOCTYPE xml>
-<xml>
-<transactions>
-<transaction vaultname="Type in the name of the vault here" date="123459" type="import_lists">
-<list name="Materials">
<item item_name="Ceramic"/>
<item item_name="Ferrous Metal"/>
<item item_name="Nonferrous Metal"/>
<item item_name="Superalloy"/>
</list>
-<list name="Ceramics">
<item item_name="Boride"/>
<item item_name="Carbide"/>
<item item_name="Nitride"/>
<link link_value="Ceramic" list_variable="Material Type" source_variable="My Material"/>
</list>
-<list name="Ferrous Metals">
<item item_name="Stainless Steel"/>
<item item_name="Carbon Steel"/>
<item item_name="Tool Steel"/>
<link link_value="Ferrous Metal" list_variable="Material Type" source_variable="My Material"/>
</list>
-<list name="Nonferrous Metals">
<item item_name="Aluminium Alloy"/>
<item item_name="Copper Alloy"/>
<item item_name="Tin Alloy"/>
<link link_value="Nonferrous Metal" list_variable="Material Type" source_variable="My Material"/>
</list>
-<list name="Superalloys">
<item item_name="Cobalt Base"/>
<item item_name="Iron Base"/>
<item item_name="Nickel base"/>
<link link_value="Superalloy" list_variable="Material Type" source_variable="My Material"/>
</list>
</transaction>
</transactions>
</xml>
I have the data in Excel and I would like to use VBA code similar to the below, but I am having a devil of a time getting it to output as shown above. When I change the tags to what I need in the sample output the result is just a mess. I am sure its my limited exposure to XML that has me stumbling. If someone could show me a sample set of the VBA that would output some of the above it would get me rolling again.
Dim FSO As Object
Dim NewFile As Object
Dim FullPath As String
Dim XMLFileText As String
FullPath = "C:\Users\Administrator\Desktop\Guy2.xml"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set NewFile = FSO.CreateTextFile(FullPath, 1, 1)
XMLFileText = ""
XMLFileText = XMLFileText & "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>" & vbNewLine
XMLFileText = XMLFileText & "<DATAROOT>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<DATA>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<c10>" & Range("C10") & "</c10>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<D10>" & Range("D10") & "</D10>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<E10>" & Range("E10") & "</E10>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "</DATA>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<DATA>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<C11>" & Range("C11") & "</C11>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<D11>" & Range("D11") & "</D11>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "<E11>" & Range("E11") & "</E11>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "</DATA>" & vbNewLine
NewFile.Write (XMLFileText)
XMLFileText = "</DATAROOT>" & vbNewLine
NewFile.Write (XMLFileText)
NewFile.Close
modified 30-Sep-14 22:30pm.
|
|
|
|
|
You'll probably get better results if you use the MSXML components[^] to generate your XML document. Apart from anything else, it will take care of properly encoding your string values.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
XML
="1.0"="UTF-8"
<catalog>
<example>
:20:FT13261793408907
N23B:CRED
SA32A:130918USD111670,00
</example>
</catalog>
XSLT
="1.0"="UTF-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="catalog">
<tr>
<td><xsl:value-of select="example"> </td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Current OUTPUT
:20:FT13261793408907 N23B:CRED SA32A:130918USD111670,00
Desired OUTPUT
:20:FT13261793408907
N23B:CRED
SA32A:130918USD111670,00
output must not be in a same line its must be as shown in the desired o/p
|
|
|
|
|