Search Results

Search found 933 results on 38 pages for 'xslt'.

Page 9/38 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • XSLT 1.0 grouping to reformat element defined by date into element defined by task

    - by Daniel
    Hi folks, I have a tricky XSLT transformation and I'd like your advise My xml is formatted as below: <Person> <name>John</name> <date>June12</date> <workTime taskID=1>34</workTime> <workTime taskID=2>12</workTime> </Person> <Person> <name>John</name> <date>June12</date> <workTime taskID=1>21</workTime> <workTime taskID=2>11</workTime> </Person> The output xml should be: <Person> <name>John</name> <taskID>1</taskID> <workTime> <date>June12</date> <time>34</time> </worTime> <workTime> <date>June13</date> <time>21</time> </worTime> </Person> <Person> <name>John</name> <taskID>2</taskID> <workTime> <date>June12</date> <time>12</time> </worTime> <workTime> <date>June13</date> <time>11</time> </worTime> </Person> Essentially, as an input, a "Person" object gathers all the task/workTime for a specific date. As an output, I want the "Person" object to gather the date/workTime for a specific task. I need to use XLST 1.0. I've been trying to use grouping with key but get very puzzled. Appreciate your help. Daniel

    Read the article

  • Explanation of converting exporting an XML document as a relational database using XSLT

    - by Yaaqov
    I would like to better understand the basic steps needed to a take an XML document like this Breakfast Menu... <?xml version="1.0" encoding="ISO-8859-1"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description>light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> <food> <name>Berry-Berry Belgian Waffles</name> <price>$8.95</price> <description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> <calories>900</calories> </food> <food> <name>French Toast</name> <price>$4.50</price> <description>thick slices made from our homemade sourdough bread</description> <calories>600</calories> </food> <food> <name>Homestyle Breakfast</name> <price>$6.95</price> <description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description> <calories>950</calories> </food> </breakfast_menu> And "export" it to say, an Access or MySQL database using XSLT, creating two joined tables: Table: breakfast_menu Field: menu_item_id Field: food_id Table: food Field: food_id Field: name Field: price Field: description Field: calories If there are online tutorials on this that you know of, I'd be interesting in learning more, as well. Thanks.

    Read the article

  • remove xml tags with XSLT

    - by azathoth
    Hello all I have the following xml file: <xfa:data> <form1> <Page1> <Page2> <contractInfo> ... </contractInfo> <paymentInfo> ... </paymentInfo> </form1> <commercialType> .... </commercialType> <userList> ... </userList> <officesList> ... </officesList> <commercialType> .... </commercialType> <userList> ... </userList> <officesList> ... </officesList> <commercialType> .... </commercialType> <userList> ... </userList> <officesList> ... </officesList> </xfa:data> I want to remove every ocurrence of the commercialType, userList and officesList nodes, so my output would be : <xfa:data> <form1> <Page1> <Page2> <contractInfo> ... </contractInfo> <paymentInfo> ... </paymentInfo> </form1> </xfa:data> How could I do that using XSLT? Thank you

    Read the article

  • XML and XSLT: need it to sort only certain child nodes

    - by MT
    Hello, I need to have my XSLT stylesheet sort my XML file's child nodes, but only certain ones. Here's an example of what the XML is like: <?xml version="1.0"?> <xmltop> <child1 num="1"> <data>12345</data> </child1> <child1 num="2"> <data>12345</data> </child1> <child2 num="3"> <data>12345</data> </child2> <child2 num="2"> <data>12345</data> </child2> <child2 num="1"> <data>12345</data> </child2> </xmltop> And this is the XSL file I'm using: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/xmltop"> <xsl:copy> <xsl:apply-templates> <xsl:sort select="@num"/> </xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="child2"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> This creates problems for me because the nodes are stripped of their tags, and their contents remain, making my XML invalid. I'm not really an expert at XSL so pardon me if this is a dumb question. The <child2>'s are sorted properly. Thank you.

    Read the article

  • XSLT Stylesheet works with a vbs script, but not Perl

    - by user2472274
    I have a program that is essentially a search application, and it exists in both VBScript and Perl form (I'm trying to make an executable with a GUI). Currently the search application outputs an HTML file, and if a section of text in the HTML is longer than twelve lines then it hides anything after that and includes a clickable More... tag. This is done in XSLT and works with VBScript. I literally copied and pasted the stylesheet into the Perl program that I'm using and it does everything right except for the More... tag. Is there any reason why it would be working with the VBScript but not Perl? I'm using XML::LibXSLT in the Perl script, and here is the template that is supposed to be creating the More... tag <xsl:template name="more"> <xsl:param name="text"/> <xsl:param name="row-id"/> <xsl:param name="cycle" select="1"/> <xsl:choose> <xsl:when test="($cycle &gt; 12) and contains($text,'&#13;')"> <span class="show" onclick="showID('SHOW{$row-id}');style.display = 'none';">More...</span> <span class="hidden" id="SHOW{$row-id}"> <xsl:call-template name="highlight"> <xsl:with-param name="text" select="$text"/> </xsl:call-template> </span> </xsl:when> <xsl:when test="contains($text,'&#13;')"> <xsl:call-template name="highlight"> <xsl:with-param name="text" select="substring-before($text,'&#13;')"/> </xsl:call-template> <xsl:text>&#13;</xsl:text> <xsl:call-template name="more"> <xsl:with-param name="text" select="substring-after($text,'&#13;')"/> <xsl:with-param name="row-id" select="$row-id"/> <xsl:with-param name="cycle" select="$cycle + 1"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="highlight"> <xsl:with-param name="text" select="$text"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template>

    Read the article

  • Looping through all attributes of a XML element in XSLT

    - by TheGNUGuy
    Hey everyone, I am trying to use <xsl:for-each select="@*"> to grab all the attributes of a given element but when i do that my <xsl:choose> statement doesn't execute. Here is the element that I'm working with: <textBox id="Airfare" value="" label="text 1"/> Here is the XSLT template I'm using: <xsl:template match="textBox"> <div> <xsl:choose> <xsl:when test="@label"> <xsl:value-of select="@label"/> </xsl:when> <xsl:otherwise> <xsl:text>No Label Defined</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:element name="input"> <xsl:attribute name="type">text</xsl:attribute> <xsl:for-each select="@*"> <xsl:choose> <xsl:when test="@id"> <xsl:attribute name="name">form_<xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="id">form_<xsl:value-of select="@id"/></xsl:attribute> </xsl:when> <xsl:when test="@label"> </xsl:when> <xsl:otherwise> <xsl:copy-of select="current()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:element> </div> And when I generate the HTML using PHP I get this: <div>text 1<input type="text" id="Airfare" value="" label="text 1"></div> As you can see it didn't add form_ to the id attribute it didn't generate a name attribute and it didn't skip over the label attribute. Thanks for your help!

    Read the article

  • Separating positive values from 'zero' values in an XSLT for-each statement

    - by danielle
    I am traversing an XML file (that contains multiple tables) using XSLT. Part of the job of the page is to get the title of each table, and present that title with along with the number of items that table contains (i.e. "Problems (5)"). I am able to get the number of items, but I now need to separate the sections with 0 (zero) items in them, and put them at the bottom of the list of table titles. I'm having trouble with this because the other items with positive numbers need to be left in their original order/not sorted. Here is the code for the list of titles: <ul> <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title"> <li style="list-style-type:none;"> <div style = "padding:3px"><a href="#{generate-id(.)}"> <xsl:variable name ="count" select ="count(../n1:entry)"/> <xsl:choose> <xsl:when test = "$count != 0"> <xsl:value-of select="."/> (<xsl:value-of select="$count"/>) </xsl:when> <xsl:otherwise> <div id = "zero"><xsl:value-of select="."/> (<xsl:value-of select="$count"/>)</div> </xsl:otherwise> </xsl:choose> </a> </div> </li> </xsl:for-each> </ul> Right now, the "zero" div just marks each link as gray. Any help regarding how to place the "zero" divs at the bottom of the list would be greatly appreciated. Thank you!

    Read the article

  • Usage of Document() function in XSLT 1.0

    - by infant programmer
    I am triggering the transformation using a .NET code, unless I add "EnableDocumentFunction" property to the XSL-Setting, the program throws error saying .. "Usage of Document() function is prohibited", Actually the program is not editable and a kind of read-only .. is it possible to edit the XSL code itself so that I can use document() function?? The sample XSL and XMLs are Here: Sample XML : <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:variable name="State_Code_Trn"> <State In="California" Out="CA"/> <State In="CA" Out="CA"/> <State In="Texas" Out="TX"/> <State In="TX" Out="TX"/> </xsl:variable> <xsl:template name="testing" match="test_node"> <xsl:variable name="test_val"> <xsl:value-of select="."/> </xsl:variable> <xsl:element name="{name()}"> <xsl:choose> <xsl:when test="document('')/*/xsl:variable[@name='State_Code_Trn'] /State[@In=$test_val]"> <xsl:value-of select="document('')/*/xsl:variable[@name='State_Code_Trn'] /State[@In=$test_val]/@Out"/> </xsl:when> <xsl:otherwise> <xsl:text>Other</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> </xsl:stylesheet> And the sample XML : <?xml version="1.0" encoding="utf-8"?> <root> <test_node>California</test_node> <test_node>CA</test_node> <test_node> CA</test_node> <test_node>Texas</test_node> <test_node>TX</test_node> <test_node>CAA</test_node> <test_node></test_node> </root>

    Read the article

  • XSLT: How to remove the self-closed elment

    - by Daoming Yang
    I have a large xml file which contents a lot of self-closed tags. How could remove all them by using XSLT. eg. <?xml version="1.0" encoding="utf-8" ?> <Persons> <Person> <Name>user1</Name> <Tel /> <Mobile>123</Mobile> </Person> <Person> <Name>user2</Name> <Tel>456</Tel> <Mobile /> </Person> <Person> <Name /> <Tel>123</Tel> <Mobile /> </Person> <Person> <Name>user4</Name> <Tel /> <Mobile /> </Person> </Persons> I'm expecting the result: <?xml version="1.0" encoding="utf-8" ?> <Persons> <Person> <Name>user1</Name> <Mobile>123</Mobile> </Person> <Person> <Name>user2</Name> <Tel>456</Tel> </Person> <Person> <Tel>123</Tel> </Person> <Person> <Name>user4</Name> </Person> </Persons> Note: there are thousands of different elements, how can I programmatically remove all the self-closed tags. Another question is how to remove the empty element such as <name></name> as well. Can anyone help me on this? Many thanks.

    Read the article

  • Sanitizing DB inputs with XSLT

    - by azathoth
    Hello I've been looking for a method to strip my XML content of apostrophes (') like: <name> Jim O'Connor</name> since my DBMS is complaining of receiving those. By looking at the example described here, that is supposed to replace ' with '', I constructed the following script: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> <xsl:template name="sqlApostrophe"> <xsl:param name="string" /> <xsl:variable name="apostrophe">'</xsl:variable> <xsl:choose> <xsl:when test="contains($string,$apostrophe)"> <xsl:value-of select="concat(substring-before($string,$apostrophe), $apostrophe,$apostrophe)" disable-output-escaping="yes" /> <xsl:call-template name="sqlApostrophe"> <xsl:with-param name="string" select="substring-after($string,$apostrophe)" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string" disable-output-escaping="yes" /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node()|@*"> <xsl:apply-templates name="sqlApostrophe"/> </xsl:template> </xsl:stylesheet> However, the processor isn't accepting it. What am I missing here? Is there a better way to get rid of the apostrophes? Perhaps another approach for sanitizing DB inputs by using XSLT? Thanks for your help

    Read the article

  • Grouping on Multiple Field

    - by Nisarg Mehta
    Hi , I am generating XML file from Database as below... <?xml version = '1.0'?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> </T0019> I have taken first two records from generated XSLT. With the use of XSLT I have tried lot to group record on basis of IFTA_LICENSE_NUMBER,IFTA_BASE_COUNTRY,IFTA_BASE_ST ATE,NAME_TYPE,ADDRESS_TYPE but i failed to generated XML like this.. <?xml version="1.0" encoding="UTF-8" ?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_STATUS_CODE>0</IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <IFTA_NAME> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <IFTA_ADDRESS> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> <IFTA_ADDRESS> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY /> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> </IFTA_NAME> </IFTA_ACCOUNT> </T0019>

    Read the article

  • XML/XSL nub: Is it possible to create an COMPOSITE XML/XSLT document?

    - by jmweekes
    I have just recently (like 2 days) started using XSLT documents with XML. I understand the basics and am able to generate a formatted document using an .XML document that references a separate .XSLT document. My question, as in the subject, is "Is it possible to create a SINGLE, composite document that contains both the XML data and XSLT processing/formatting/styling and displays as formatted HTML?" I am writing a desktop application in which I need to generate a formatted document on the fly from XML stored in the database. I want to do this without creating or referencing any actual physical files. I will generate a text string containing the XML/XSLT document and feed this to a WebBrowser component for formatted display. Hopefully what I want to do doesn't totally go against the whole XML/XSLT methodology. Any information, direction or suggestions will be greatly appreciated.

    Read the article

  • Recursive XML through XSLT to XML

    - by Patrick
    Essentially, I have XML structured like this: <A> <B> <1>data</1> <2>data</2> <C> <1>data</1> <2>data</2> <B> <1>data</1> <2>data</2> <C> <B> <1>data</1> <2>data</2> </B> </C> </B> <B> <1>data</1> <2>data</2> </B> </C> </B> </A> I am trying to get the output to look like this: <A> <B 1="data" 2="data"> <C 1="data" 2="data"> <B 1="data" 2="data"> <C> <B 1="data" 2="data" > </B> </C> </B> <B 1="data" 2="data" > </B> </C> </B> </A> I have figured out how to put everything as attributes and start looping through the elements. The issue I am facing is that when trying to get below the first C, nothing happens. Here is my code: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <MenuDataResult> <B> <xsl:apply-templates /> </B> </MenuDataResult> </xsl:template> <xsl:template match="B"> <xsl:for-each select="B"> <B ItemID="{B/ItemID/text()}" ItemType="{ItemType/text()}" ItemSubType="{ItemSubType/text()}" ItemTitle="{ItemTitle/text()}" ItemImage="{ItemImage/text()}" ItemImageOverride="{ItemImageOverride/text()}" ItemLink="{ItemLink/text()}" ItemTarget="{ItemTarget/text()}>"> <xsl:for-each select="C"> <xsl:apply-templates select="C"/> </xsl:for-each> </B> </xsl:for-each> </xsl:template> <xsl:template match="C"> <C ID="{ID/text()}" Title="{Title/text()}" Template="{Template/text()}" Type="{Type/text()}" Link="{Link/text()}" ParentID="{ParentID/text()}" AncestorID="{AncestorID/text()}" FolderID="{FolderID/text()}" Description="{Description/text()}" Image="{Image/text()}" ImageOverride="{ImageOverride/text()}"> <xsl:for-each select="B"> <xsl:apply-templates select=".//B"/> </xsl:for-each> </C> </xsl:template> </xsl:stylesheet>

    Read the article

  • XSLT: a variation on the pagination problem

    - by MarcoS
    I must transform some XML data into a paginated list of fields. Here is an example. Input XML: <?xml version="1.0" encoding="UTF-8"?> <data> <books> <book title="t0"/> <book title="t1"/> <book title="t2"/> <book title="t3"/> <book title="t4"/> </books> <library name="my library"/> </data> Desired output: <?xml version="1.0" encoding="UTF-8"?> <pages> <page number="1"> <field name="library_name" value="my library"/> <field name="book_1" value="t0"/> <field name="book_2" value="t1"/> </page> <page number="2"> <field name="book_1" value="t2"/> <field name="book_2" value="t3"/> </page> <page number="3"> <field name="book_1" value="t4"/> </page> </pages> In the above example I assume that I want at most 2 fields named book_n (with n ranging between 1 and 2) per page. Tags <page> must have an attribute number. Finally, the field named library_name must appear only the first <page>. Here is my current solution using XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="trx xs"> <xsl:output method="xml" indent="yes" omit-xml-declaration="no" /> <xsl:variable name="max" select="2"/> <xsl:template match="//books"> <xsl:for-each-group select="book" group-ending-with="*[position() mod $max = 0]"> <xsl:variable name="pageNum" select="position()"/> <page number="{$pageNum}"> <xsl:for-each select="current-group()"> <xsl:variable name="idx" select="if (position() mod $max = 0) then $max else position() mod $max"/> <field value="{@title}"> <xsl:attribute name="name">book_<xsl:value-of select="$idx"/> </xsl:attribute> </field> </xsl:for-each> <xsl:if test="$pageNum = 1"> <xsl:call-template name="templateFor_library"/> </xsl:if> </page> </xsl:for-each-group> </xsl:template> <xsl:template name="templateFor_library"> <xsl:for-each select="//library"> <field name="library_name" value="{@name}" /> </xsl:for-each> </xsl:template> </xsl:stylesheet> Is there a better/simpler way to perform this transformation?

    Read the article

  • reorder XML elements or set an explicit template with XSLT

    - by Sash
    I tried the solution in my previous question (flattening XML to load via SSIS package), however this isn't working. I now know what I need to do, however I need some guidance on how to do it. So say I have the following XML structure: <person id="1"> <name>John</name> <surname>Smith</surname> <age>25</age> <comment> <comment_id>1</comment_id> <comment_text>Hello</comment_text> </comment> <comment> <comment_id>2</comment_id> <comment_text>Hello again!</comment_text> </comment> <somethingelse> <id>1</id> </somethingelse> <comment> <comment_id>3</comment_id> <comment_text>Third Item</comment_text> </comment> </person> <person id="2"> <name>John</name> <surname>Smith</surname> <age>25</age> <somethingelse> <id>1</id> </somethingelse> </person> ... ... If I am to load this into a SSIS package, as an XML source, what I will essentially get is a table created for each element, as opposed to get a structured table output such as person table (name, surname, age) somethingelse table (id) comment table (comment_id, comment_text) What I end up getting is: person table (person_Id <-- internal SSIS id) name table surname table age table person_name table person_surname table person_comment_comment_id table etc... What I found was that if each element and all inner elements are not in the same format and consistency, i will get the above anomaly which makes it rather complex especially if I am dealing with 80 - 100+ columns. Unfortunately I have no way of modifying the system (Lotus Notes) that produces these reports, so I was wondering whether I may be able to explicitly have an XSLT template that will be able to align each person sub elements (and the sub collection elements such as comments ? Unless there is a quicker way to realign all inner elements. Seems that SSIS XML source requires a very consistent XML file in the sense of: if the name element is in position 1, then all subsequent name elements within person parent have to be in position 1. SSIS seems to pickup the inconsistencies if there are certain elements missing from one parent to another, however, if their ordering is not right (A, B, C)(A, B, C)(A,C,B), it will chuck a massive fuss! All help is appreciated! Thank you in advance.

    Read the article

  • Regular expression in Umbraco for number validation.

    - by Vizioz Limited
    This evening I was looking for a way to validate an Umbraco node that could be either text or a numeric value, in my case a salary that could be either an hourly amount, an annual figure or a comment. In the case where the node contained a value I wanted the XSLT to output a pound sign (£) and for any that contained text it would just output the text, as this could be something like "Contact Us" or "Negotiable"I thought someone else might find this useful so here is the XSLT and the regular expression.First if you are using Umbraco, don't forget to include the reference to the EXSLT Regular expression library at the top of your XSLT.<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltRegularExpressions">Then the code I used was:<xsl:if test="Exslt.ExsltRegularExpressions:match($currentPage/data [@alias='Salary'], '^[0-9]*\,?[0-9]*\.?[0-9]+$') != ''"> <xsl:text>£</xsl:text></xsl:if>This regular expression allows any number of digits, an optional comma, more digits, an optional decimal point and finally more digits, so all the following are valid:12,00014.43334,342.03

    Read the article

  • XSLT Escape Character not working

    - by liveek
    I am trying to use escape charaters in my text output, as i would like too surround the output in emailData tags. I am using <xsl:text>&#60;emailData&#62;</xsl:text> In the XSLT to esnure that this works however because i am using a tool called Cast Iron for some reason it is not converting the &#60; into < and just spits out &lt;emailData> You can see am image of it HERE that illustrates the output i am getting. My source code is this. How else could i wrap this in emailData tags? <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="header"> <xsl:text>&#60;emailData&#62;</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:text>From: </xsl:text> <xsl:value-of select="from/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>To: </xsl:text> <xsl:value-of select="to/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>Subject: </xsl:text> <xsl:value-of select="subject/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Type: </xsl:text> <xsl:value-of select="contentType/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text> boundary="</xsl:text> <xsl:value-of select="boundary/text()"/> <xsl:text>"</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:text>MIME-Version: </xsl:text> <xsl:value-of select="mimeVersion/text()"/> </xsl:template> <xsl:template match="email"> <xsl:text>&#10;&#10;</xsl:text> <xsl:text>--</xsl:text> <xsl:value-of select="../header/boundary/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Type: </xsl:text> <xsl:value-of select="contentTypeBody/text()"/> <xsl:text> charset="us-ascii"</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Transfer-Encoding: </xsl:text> <xsl:value-of select="contentTransfer/text()"/> <xsl:text>&#10;&#10;</xsl:text> <xsl:value-of select="body/text()"/> </xsl:template> <xsl:template match="Attachment"> <xsl:for-each select="Attachments"> <xsl:text>&#0010;&#0010;</xsl:text> <xsl:value-of select="../../header/boundary/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Type: </xsl:text> <xsl:value-of select="attachmentContentType/text()"/> <xsl:text> name="</xsl:text> <xsl:value-of select="attachmentDescription/text()"/> <xsl:text>"</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Description: </xsl:text> <xsl:value-of select="attachmentDescription/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Disposition: attachment; filename="</xsl:text> <xsl:value-of select="atachementDisposition/text()"/> <xsl:text>"</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:text>Content-Transfer-Encoding: </xsl:text> <xsl:value-of select="attachmentContentTransfer/text()"/> <xsl:text>&#10;&#10;</xsl:text> <xsl:value-of select="attachementBody/text()"/> <xsl:text>&#10;</xsl:text> <xsl:text>&#60;/emailData&#62;</xsl:text> </xsl:for-each> </xsl:template> <xsl:template match="text()"/> </xsl:stylesheet>

    Read the article

  • XML parsing and transforming (XSLT or otherwise)

    - by observ
    I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id> </identity> <child2 attr = "aa">32</child2> <child3> <childOfChild3 att1="aaa" att2="bbb" att3="CCC">LN</childOfChild3> </child3> <child4> <child5> <child6>3ddf</child6> <child7> <childOfChild7 att31="RR">1231</childOfChild7> </child7> </child5> </child4> </OBJECT> <OBJECT> <identity> <id>124</id> </identity> <child2 attr = "bb">212</child2> <child3> <childOfChild3 att1="ee" att2="ccc" att3="EREA">OP</childOfChild3> </child3> <child4> <child5> <child6>213r</child6> <child7> <childOfChild7 att31="EE">1233</childOfChild7> </child7> </child5> </child4> </OBJECT> </ROOT> How can i format it this way?: <ROOT> <OBJECT> <id>123</id> <child2>32</child2> <attr>aa</attr> <child3></child3> <childOfChild3>LN</childOfChild3> <att1>aaa</att1> <att2>bbb</att2> <att3>CCC</att3> <child4></child4> <child5></child5> <child6>3ddf</child6> <child7></child7> <childOfChild7>1231</childOfChild7> <att31>RR</att31> </OBJECT> <OBJECT> <id>124</id> <child2>212</child2> <attr>bb</attr> <child3></child3> <childOfChild3>LN</childOfChild3> <att1>ee</att1> <att2>ccc</att2> <att3>EREA</att3> <child4></child4> <child5></child5> <child6>213r</child6> <child7></child7> <childOfChild7>1233</childOfChild7> <att31>EE</att31> </OBJECT> </ROOT> I know some C# so maybe a parser there? or some generic xslt? The xml files are some data received from a client, so i can't control the way they are sending it to me. L.E. Basically when i am trying to test this data in excel (for example i want to make sure that the attribute of childOfChild7 corresponds to the correct identity id) i am getting a lot of blank spaces. If i am importing in access to get only the data i want out, i have to do a thousands subqueries to get them all in a nice table. Basically i just want to see for one Object all its data (one object - One row) and then just delete/hide the columns i don't need.

    Read the article

  • XSLT - group response as per month and year combination

    - by alisha
    I want into write xslt to get response for the input xml. thanks in advance. I want to group output such that month year combination is not repeated for each of the employee details. Input XML: <resultset> <row> <column> <name>Month</name> <value>2</value> </column> <column> <name>Year</name> <value>2010</value> </column> <column> <name>EmpName</name> <value>Anu</value> </column> <column> <name>Age</name> <value>24</value> </column> </row> <row> <column> <name>Month</name> <value>2</value> </column> <column> <name>Year</name> <value>2010</value> </column> <column> <name>EmpName</name> <value>Nancy</value> </column> <column> <name>Age</name> <value>26</value> </column> </row> <row> <column> <name>Month</name> <value>3</value> </column> <column> <name>Year</name> <value>2010</value> </column> <column> <name>EmpName</name> <value>Ned</value> </column> <column> <name>Age</name> <value>25</value> </column> </row> </resultset> Output expected: <Response> <PeriodInfo> <Month>2</Month> <Year>2010</Year> <EmployeeDetails> <Name>Anu</Name> <Age>24</Age> </EmployeeDetails> <EmployeeDetails> <Name>Nancy</Name> <Age>26</Age> </EmployeeDetails> </PeriodInfo> <PeriodInfo> <Month>3</Month> <Year>2010</Year> <EmployeeDetails> <Name>Ned</Name> <Age>25</Age> </EmployeeDetails> </PeriodInfo> </Response>

    Read the article

  • XSLT typograph.

    - by kalininew
    Divide a large amount of text on an arbitrary number of equal parts. I probably already fed up with their stupid questions, but I have one more question. I have a large piece of text <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> At the exit I need to divide the text on the "n" equal parts, so that in these parts was about the same amount of text. Then I these part are arranged in columns and the need for these columns look about the same height. Another condition: Tags you can break (I mean that if the tag "p" contains a lot of text, it can be divided into two parts, to bring in another column). I think this is a monumental task, I shall be grateful for any help. I understand that XSLT is not typography tool. But it is possible divide the text into parts with the same number of characters in each

    Read the article

  • How to recursively delete some xml elements using XSLT

    - by Monomachus
    Hi, So I got this situation which sucks. I have an XML like this <table border="1" cols="200 100pt 200"> <tr> <td>isbn</td> <td>title</td> <td>price</td> </tr> <tr> <td /> <td /> <td> <span type="champsimple" id="9b297fb5-d12b-46b1-8899-487a2df0104e" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f"> [prénom] </span> <span type="champsimple" id="e103a6a5-d1be-4c34-8a54-d234179fb4ea" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f">[nom]</span> <span></span> </td> </tr> <tr></tr> <tr> <td></td> <td>Phill It in</td> </tr> <tr> <table id="cas1"> <tr> <td ></td> <td >foo</td> </tr> <tr> <td >bar</td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas2"> <tr> <td ></td> <td >foo</td> </tr> <tr> <td ></td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas3"> <tr> <td >bar</td> <td ></td> </tr> <tr> <td >foo</td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas4"> <tr> <td /> <td /> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <table id="cas4"> <tr> <td /> <td /> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> <tr> <td /> <td /> </tr> </table> Now the question is how would I recursively delete all empty td, tr and table elements? Now I use this XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="td[not(node())]" /> <xsl:template match="tr[not(node())]" /> <xsl:template match="table[not(node())]" /> </xsl:stylesheet> But it doesn't do very well. After I delete td, a tr becomes empty but it doesn't handle that. Too bad. See the table element with "cas4". <table border="1" cols="200 100pt 200"> <tr> <td>isbn</td> <td>title</td> <td>price</td> </tr> <tr> <td> <span type="champsimple" id="9b297fb5-d12b-46b1-8899-487a2df0104e" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f"> [prénom] </span> <span type="champsimple" id="e103a6a5-d1be-4c34-8a54-d234179fb4ea" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f">[nom]</span> <span /> </td> </tr> <tr> <td>Phill It in</td> </tr> <tr> <table id="cas1"> <tr> <td>foo</td> </tr> <tr> <td>bar</td> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas2"> <tr> <td>foo</td> </tr> <tr> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas3"> <tr> <td>bar</td> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas4"> <tr /> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <table id="cas4"> <tr /> <tr> <td>foo</td> <td>boo</td> </tr> </table> <tr /> </table> How would you solve this problem?

    Read the article

  • How to Use XSLT to Replace Coordinate Separator With List of Tuples?

    - by kuloch
    I have a space-separated list of coordinate tuples. Each tuple consists of a space-separated list of 2-dimensional coordinates. E.g. "1.1 2.8 1.2 2.9" represents a line from POINT(1.1 2.8) to POINT(1.2 2.9). I need this to instead be "1.1,2.8 1.2,2.9". How would I use XSLT to perform the replacement of space-to-comma between pairs of numbers? I have the "string(gml:LinearRing/gml:posList)". This is being used on a Java Web Service that spits out GML 3.1.1 features with geometries. The service supports optional KML output, by using XSLT to transform the GML document into a KML document (at least, the chunks deemed "important"). I am locked into XSLT 1.0, so regex from XSLT 2.0 is not an option. I am aware that GML uses lat/lon while KML uses lon/lat. That's being handled before XSLT, though it would be nice to have that also done with XSLT.

    Read the article

  • How to eliminate duplicate nodes bases on values of multiple attributes?

    - by JayRaj
    Hello All, How can I eliminate duplicate nodes based on values of multiple (more than 1) attributes? Also the attribute names are passed as parameters to the stylesheet. Now I am aware of the Muenchian method of grouping that uses a <xsl:key> element. But I came to know that XSLT 1.0 does not allow paramters/variables in <xsl:key>. Is there another method(s) to achieve duplicate nodes removal? It is fine if it not as efficient as the Munechian method. Update from previus question: XML: <data id = "root"> <record id="1" operator1='xxx' operator2='yyy' operator3='zzz'/> <record id="2" operator1='abc' operator2='yyy' operator3='zzz'/> <record id="3" operator1='abc' operator2='yyy' operator3='zzz'/> <record id="4" operator1='xxx' operator2='yyy' operator3='zzz'/> <record id="5" operator1='xxx' operator2='lkj' operator3='tyu'/> <record id="6" operator1='xxx' operator2='yyy' operator3='zzz'/> <record id="7" operator1='abc' operator2='yyy' operator3='zzz'/> <record id="8" operator1='abc' operator2='yyy' operator3='zzz'/> <record id="9" operator1='xxx' operator2='yyy' operator3='zzz'/> <record id="10" operator1='rrr' operator2='yyy' operator3='zzz'/> </data>

    Read the article

  • XSLT templates and recursion

    - by user333411
    Hi All, Im new to XSLT and am having some problems trying to format an XML document which has recursive nodes. My XML Code: Hopefully my XML shows: All <item> are nested with <items> An item can have either just attributes, or sub nodes The level to which <item> nodes are nested can be infinently deep <?xml version="1.0" encoding="utf-8" ?> - <items> <item groupID="1" name="Home" url="//" /> - <item groupID="2" name="Guides" url="/Guides/"> - <items> - <item groupID="26" name="Online-Poker-Guide" url="/Guides/Online-Poker-Guide/"> - <items> - <item> <id>107</id> - <title> - <![CDATA[ Poker Betting - Online Poker Betting Structures ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-betting-structures ]]> </url> </item> - <item> <id>114</id> - <title> - <![CDATA[ Beginners&#39; Poker - Poker Hand Ranking ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-hand-ranking ]]> </url> </item> - <item> <id>115</id> - <title> - <![CDATA[ Poker Terms - 4th Street and 5th Street ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-poker-terms ]]> </url> </item> - <item> <id>116</id> - <title> - <![CDATA[ Popular Poker - The Popularity of Texas Hold&#39;em ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-popularity-texas-holdem ]]> </url> </item> - <item> <id>364</id> - <title> - <![CDATA[ The Impact of Traditional Poker on Online Poker (and vice versa) ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-tradional-vs-online ]]> </url> </item> - <item> <id>365</id> - <title> - <![CDATA[ The Ultimate, Absolute Online Poker Scandal ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/online-poker-scandal ]]> </url> </item> </items> - <items> - <item groupID="27" name="Beginners-Poker" url="/Guides/Online-Poker-Guide/Beginners-Poker/"> - <items> + <item> <id>101</id> - <title> - <![CDATA[ Poker Betting - All-in On the Flop ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/poker-betting-all-in-on-the-flop ]]> </url> </item> + <item> <id>102</id> - <title> - <![CDATA[ Beginners&#39; Poker - Choosing an Online Poker Room ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/beginners-poker-choosing-a-room ]]> </url> </item> + <item> <id>105</id> - <title> - <![CDATA[ Beginners&#39; Poker - Choosing What Type of Poker to Play ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/beginners-poker-choosing-type-to-play ]]> </url> </item> + <item> <id>106</id> - <title> - <![CDATA[ Online Poker - Different Types of Online Poker ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/online-poker ]]> </url> </item> + <item> <id>109</id> - <title> - <![CDATA[ Online Poker - Opening an Account at an Online Poker Site ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/online-poker-opening-an-account ]]> </url> </item> + <item> <id>111</id> - <title> - <![CDATA[ Beginners&#39; Poker - Poker Glossary ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/beginners-poker-glossary ]]> </url> </item> + <item> <id>117</id> - <title> - <![CDATA[ Poker Betting - What is a Blind? ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/poker-betting-what-is-a-blind ]]> </url> </item> - <item> <id>118</id> - <title> - <![CDATA[ Poker Betting - What is an Ante? ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/poker-betting-what-is-an-ante ]]> </url> </item> + <item> <id>119</id> - <title> - <![CDATA[ Beginners Poker - What is Bluffing? ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/online-poker-what-is-bluffing ]]> </url> </item> - <item> <id>120</id> - <title> - <![CDATA[ Poker Games - What is Community Card Poker? ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/online-poker-what-is-community-card-poker ]]> </url> </item> - <item> <id>121</id> - <title> - <![CDATA[ Online Poker - What is Online Poker? ]]> </title> - <url> - <![CDATA[ /Guides/Online-Poker-Guide/Beginners-Poker/online-poker-what-is-online-poker ]]> </url> </item> </items> </item> </items> </item> </items> </item> </items> The XSL code: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:template name="loop"> <xsl:for-each select="items/item"> <ul> <li><xsl:value-of select="@name" /></li> <xsl:if test="@name and child::node()"> <ul> <xsl:for-each select="items/item"> <li><xsl:value-of select="@name" />test</li> </xsl:for-each> </ul> <xsl:call-template name="loop" /> </xsl:if> <xsl:if test="child::node() and not(@name)"> <xsl:for-each select="/items"> <li><xsl:value-of select="id" /></li> </xsl:for-each> </xsl:if> </ul> </xsl:for-each> <xsl:for-each select="item/items/item"> <li>hi</li> </xsl:for-each> </xsl:template> <xsl:template match="/" name="test"> <xsl:call-template name="loop" /> </xsl:template> </xsl:stylesheet> Im trying to write the XSL so that every <items> node will render a <ul> and every <items> node will render an <li>. The XSL needs to be recursive because i cant tell how deep the nested nodes will go. Can anyone help? Regards, Al

    Read the article

  • Removing duplicate elements with XSLT

    - by user1439459
    I need to eliminate duplicate elements from my XML using a specific node (ItemID) My XML Looks as follows; <XML> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>723073</ItemID> <ColorID>02</ColorID> <Description>Pentel LR7 Energel Metal Tip Refill 0.7mm</Description> <MainCategory>WRITING INSTRUMENTS</MainCategory> <SubCategory>Refill</SubCategory> <LineNum> 1.0000000</LineNum> <Qty> 6.0000000</Qty> <UnitPriceExclTax> 10.0200000</UnitPriceExclTax> <LineTax> 8.4200000</LineTax> <LinePriceExclTax> 60.1200000</LinePriceExclTax> <ColorName>Black</ColorName> <UOM>EA</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637542_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>903420</ItemID> <ColorID /> <Description>STEPHENS JUNIOR Stapler Half Strip KW586</Description> <MainCategory>OFFICE SUNDRIES</MainCategory> <SubCategory>Staplers</SubCategory> <LineNum> 2.0000000</LineNum> <Qty> 3.0000000</Qty> <UnitPriceExclTax> 32.2500000</UnitPriceExclTax> <LineTax> 13.5400000</LineTax> <LinePriceExclTax> 96.7500000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637547_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>867241</ItemID> <ColorID /> <Description>TRODAT PRINTY S/Inking Stamp Copy 4911</Description> <MainCategory>STAMPS DATERS NUMBERERS</MainCategory> <SubCategory>Self Inking Stamps</SubCategory> <LineNum> 3.0000000</LineNum> <Qty> 1.0000000</Qty> <UnitPriceExclTax> 42.1500000</UnitPriceExclTax> <LineTax> 5.9000000</LineTax> <LinePriceExclTax> 42.1500000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 1.0000000</Backorder> <INVENTTRANSID> CAP5637548_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>941151</ItemID> <ColorID /> <Description>PENTEL Correction Tape 5mx5mm ZT35</Description> <MainCategory>OFFICE SUNDRIES</MainCategory> <SubCategory>Correction Fluid/Pens/Tape</SubCategory> <LineNum> 4.0000000</LineNum> <Qty> 2.0000000</Qty> <UnitPriceExclTax> 25.1500000</UnitPriceExclTax> <LineTax> 7.0400000</LineTax> <LinePriceExclTax> 50.3000000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637549_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>801215</ItemID> <ColorID /> <Description>MONDI ROTATRIM Copy Paper A4 80Gsm White</Description> <MainCategory>A4 Paper</MainCategory> <SubCategory>White Bond Paper</SubCategory> <LineNum> 5.0000000</LineNum> <Qty> 100.0000000</Qty> <UnitPriceExclTax> 29.0100000</UnitPriceExclTax> <LineTax> 406.1400000</LineTax> <LinePriceExclTax> 2901.0000000</LinePriceExclTax> <ColorName /> <UOM>Pkt 500</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637552_060</INVENTTRANSID> </Line> <Line> <SALESID> CAP716197SO</SALESID> <INVOICEID> CAP600795SI</INVOICEID> <INVOICEDATE>2010/05/06</INVOICEDATE> <NUMBERSEQUENCEGROUP /> <LINENUM> 2.0000000</LINENUM> <ITEMID>805236</ITEMID> <INVENTDIMID> CAP0000594_061</INVENTDIMID> <NAME>Ruled Paper A4 Fnt/Marg JD76</NAME> <CONFIRMEDDLV>2010/05/06</CONFIRMEDDLV> <INVENTTRANSID> CAP5637543_060</INVENTTRANSID> <QTYSALES> 4.0000000</QTYSALES> <QTYORDERED> 4.0000000</QTYORDERED> <QTYBACKORDERSALES> 4.0000000</QTYBACKORDERSALES> <QTYBACKORDERINVENT> 4.0000000</QTYBACKORDERINVENT> <SALESUNIT>EA</SALESUNIT> <ORIGSALESID> CAP716197SO</ORIGSALESID> <DATAAREAID>wal</DATAAREAID> <RECID>622392608</RECID> <RecVersion>1</RecVersion> </Line> <Line> <SALESID> CAP716197SO</SALESID> <INVOICEID> CAP600795SI</INVOICEID> <INVOICEDATE>2010/05/06</INVOICEDATE> <NUMBERSEQUENCEGROUP /> <LINENUM> 3.0000000</LINENUM> <ITEMID>941150</ITEMID> <INVENTDIMID> CAP0000594_061</INVENTDIMID> <NAME>PENGUIN Correction Fluid 20ml White</NAME> <CONFIRMEDDLV>2010/05/06</CONFIRMEDDLV> <INVENTTRANSID> CAP5637546_060</INVENTTRANSID> <QTYSALES> 6.0000000</QTYSALES> <QTYORDERED> 6.0000000</QTYORDERED> <QTYBACKORDERSALES> 6.0000000</QTYBACKORDERSALES> <QTYBACKORDERINVENT> 6.0000000</QTYBACKORDERINVENT> <SALESUNIT>EA</SALESUNIT> <ORIGSALESID> CAP716197SO</ORIGSALESID> <DATAAREAID>wal</DATAAREAID> <RECID>622392609</RECID> <RecVersion>1</RecVersion> </Line> <Line> <SALESID> CAP716197SO</SALESID> <INVOICEID> CAP600795SI</INVOICEID> <INVOICEDATE>2010/05/06</INVOICEDATE> <NUMBERSEQUENCEGROUP /> <LINENUM> 5.0000000</LINENUM> <ITEMID>867241</ITEMID> <INVENTDIMID> CAP0000594_061</INVENTDIMID> <NAME>TRODAT PRINTY S/Inking Stamp Copy 4911</NAME> <CONFIRMEDDLV>2010/05/06</CONFIRMEDDLV> <INVENTTRANSID> CAP5637548_060</INVENTTRANSID> <QTYSALES> 2.0000000</QTYSALES> <QTYORDERED> 2.0000000</QTYORDERED> <QTYBACKORDERSALES> 1.0000000</QTYBACKORDERSALES> <QTYBACKORDERINVENT> 1.0000000</QTYBACKORDERINVENT> <SALESUNIT>EA</SALESUNIT> <ORIGSALESID> CAP716197SO</ORIGSALESID> <DATAAREAID>wal</DATAAREAID> <RECID>622392610</RECID> <RecVersion>1</RecVersion> </Line> </XML> You will see the XML is not identical but the tag is always in the same place, and there is currently 1 duplicate 867241 I do not want the order to change, just the element removed. Desired output would be; <XML> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>723073</ItemID> <ColorID>02</ColorID> <Description>Pentel LR7 Energel Metal Tip Refill 0.7mm</Description> <MainCategory>WRITING INSTRUMENTS</MainCategory> <SubCategory>Refill</SubCategory> <LineNum> 1.0000000</LineNum> <Qty> 6.0000000</Qty> <UnitPriceExclTax> 10.0200000</UnitPriceExclTax> <LineTax> 8.4200000</LineTax> <LinePriceExclTax> 60.1200000</LinePriceExclTax> <ColorName>Black</ColorName> <UOM>EA</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637542_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>903420</ItemID> <ColorID /> <Description>STEPHENS JUNIOR Stapler Half Strip KW586</Description> <MainCategory>OFFICE SUNDRIES</MainCategory> <SubCategory>Staplers</SubCategory> <LineNum> 2.0000000</LineNum> <Qty> 3.0000000</Qty> <UnitPriceExclTax> 32.2500000</UnitPriceExclTax> <LineTax> 13.5400000</LineTax> <LinePriceExclTax> 96.7500000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637547_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>867241</ItemID> <ColorID /> <Description>TRODAT PRINTY S/Inking Stamp Copy 4911</Description> <MainCategory>STAMPS DATERS NUMBERERS</MainCategory> <SubCategory>Self Inking Stamps</SubCategory> <LineNum> 3.0000000</LineNum> <Qty> 1.0000000</Qty> <UnitPriceExclTax> 42.1500000</UnitPriceExclTax> <LineTax> 5.9000000</LineTax> <LinePriceExclTax> 42.1500000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 1.0000000</Backorder> <INVENTTRANSID> CAP5637548_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>941151</ItemID> <ColorID /> <Description>PENTEL Correction Tape 5mx5mm ZT35</Description> <MainCategory>OFFICE SUNDRIES</MainCategory> <SubCategory>Correction Fluid/Pens/Tape</SubCategory> <LineNum> 4.0000000</LineNum> <Qty> 2.0000000</Qty> <UnitPriceExclTax> 25.1500000</UnitPriceExclTax> <LineTax> 7.0400000</LineTax> <LinePriceExclTax> 50.3000000</LinePriceExclTax> <ColorName /> <UOM>Ea</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637549_060</INVENTTRANSID> </Line> <Line> <SupplierID>Waltons</SupplierID> <InvoiceID>CAP600795SI</InvoiceID> <InvoiceDate>20100506</InvoiceDate> <ItemID>801215</ItemID> <ColorID /> <Description>MONDI ROTATRIM Copy Paper A4 80Gsm White</Description> <MainCategory>A4 Paper</MainCategory> <SubCategory>White Bond Paper</SubCategory> <LineNum> 5.0000000</LineNum> <Qty> 100.0000000</Qty> <UnitPriceExclTax> 29.0100000</UnitPriceExclTax> <LineTax> 406.1400000</LineTax> <LinePriceExclTax> 2901.0000000</LinePriceExclTax> <ColorName /> <UOM>Pkt 500</UOM> <Backorder> 0.0000000</Backorder> <INVENTTRANSID> CAP5637552_060</INVENTTRANSID> </Line> <Line> <SALESID> CAP716197SO</SALESID> <INVOICEID> CAP600795SI</INVOICEID> <INVOICEDATE>2010/05/06</INVOICEDATE> <NUMBERSEQUENCEGROUP /> <LINENUM> 2.0000000</LINENUM> <ITEMID>805236</ITEMID> <INVENTDIMID> CAP0000594_061</INVENTDIMID> <NAME>Ruled Paper A4 Fnt/Marg JD76</NAME> <CONFIRMEDDLV>2010/05/06</CONFIRMEDDLV> <INVENTTRANSID> CAP5637543_060</INVENTTRANSID> <QTYSALES> 4.0000000</QTYSALES> <QTYORDERED> 4.0000000</QTYORDERED> <QTYBACKORDERSALES> 4.0000000</QTYBACKORDERSALES> <QTYBACKORDERINVENT> 4.0000000</QTYBACKORDERINVENT> <SALESUNIT>EA</SALESUNIT> <ORIGSALESID> CAP716197SO</ORIGSALESID> <DATAAREAID>wal</DATAAREAID> <RECID>622392608</RECID> <RecVersion>1</RecVersion> </Line> <Line> <SALESID> CAP716197SO</SALESID> <INVOICEID> CAP600795SI</INVOICEID> <INVOICEDATE>2010/05/06</INVOICEDATE> <NUMBERSEQUENCEGROUP /> <LINENUM> 3.0000000</LINENUM> <ITEMID>941150</ITEMID> <INVENTDIMID> CAP0000594_061</INVENTDIMID> <NAME>PENGUIN Correction Fluid 20ml White</NAME> <CONFIRMEDDLV>2010/05/06</CONFIRMEDDLV> <INVENTTRANSID> CAP5637546_060</INVENTTRANSID> <QTYSALES> 6.0000000</QTYSALES> <QTYORDERED> 6.0000000</QTYORDERED> <QTYBACKORDERSALES> 6.0000000</QTYBACKORDERSALES> <QTYBACKORDERINVENT> 6.0000000</QTYBACKORDERINVENT> <SALESUNIT>EA</SALESUNIT> <ORIGSALESID> CAP716197SO</ORIGSALESID> <DATAAREAID>wal</DATAAREAID> <RECID>622392609</RECID> <RecVersion>1</RecVersion> </Line> </XML> I can use XSLT 1 or 2 Regards,

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >