Search Results

Search found 8 results on 1 pages for 'lolliffe'.

Page 1/1 | 1 

  • Problem merging similar XML files with XSL

    - by LOlliffe
    I have two documents that I need to merge, that happen in a way that I don't seem to be able to find covered in other examples. Namely, that it needs to match not only on a node's attribute at one level, but also on the value of an attribute a node level below that, to get that node's value. I'm trying to take this sample: <?xml version="1.0" encoding="UTF-8" ?> <marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <marc:record> <marc:datafield tag="035" ind1=" " ind2=" "> <marc:subfield code="a">12345</marc:subfield> </marc:datafield> <marc:datafield tag="041" ind1=" " ind2=" "> <marc:subfield code="a">eng</marc:subfield> </marc:datafield> <marc:datafield tag="650" ind1=" " ind2="4"> <marc:subfield code="a">Art</marc:subfield> </marc:datafield> <marc:datafield tag="949" ind1=" " ind2=" "> <marc:subfield code="i">Review of conference proceedings</marc:subfield> </marc:datafield> </marc:record> <marc:record> <marc:datafield tag="035" ind1=" " ind2=" "> <marc:subfield code="a">54321</marc:subfield> </marc:datafield> <marc:datafield tag="041" ind1=" " ind2=" "> <marc:subfield code="a">eng</marc:subfield> </marc:datafield> <marc:datafield tag="650" ind1=" " ind2="4"> <marc:subfield code="a">Byzantine</marc:subfield> </marc:datafield> </marc:record> </marc:collection> And when the value of "datafield" '035', "subfield" 'a' matches e.g. "12345" <marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <marc:record> <marc:datafield ind2=" " ind1=" " tag="035"> <marc:subfield code="a">12345</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">General works</marc:subfield> <marc:subfield code="x">Historians and critics</marc:subfield> <marc:subfield code="x">Smith, John, 1834-1917</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">Généralités</marc:subfield> <marc:subfield code="x">Historiens et critiques d'art</marc:subfield> <marc:subfield code="x">Dietrichson, Lorentz, 1834-1917</marc:subfield> </marc:datafield> <marc:datafield ind2=" " ind1=" " tag="654"> <marc:subfield code="a">General works</marc:subfield> </marc:datafield> <marc:datafield ind2=" " ind1=" " tag="654"> <marc:subfield code="a">Généralités</marc:subfield> <marc:subfield code="b">Historiens et critiques d'art</marc:subfield> <marc:subfield code="b">Smith, John, 1834-1917</marc:subfield> </marc:datafield> </marc:record> <marc:record> <marc:datafield ind2=" " ind1=" " tag="035"> <marc:subfield code="a">54321</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">General works</marc:subfield> <marc:subfield code="x">Historians and critics</marc:subfield> <marc:subfield code="x">Lange, Julius Henrik, 1838-1896</marc:subfield> </marc:datafield> </marc:record> </marc:collection> The result should be: <?xml version="1.0" encoding="UTF-8" ?> <marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <marc:record> <marc:datafield tag="035" ind1=" " ind2=" "> <marc:subfield code="a">12345</marc:subfield> </marc:datafield> <marc:datafield tag="041" ind1=" " ind2=" "> <marc:subfield code="a">eng</marc:subfield> </marc:datafield> <marc:datafield tag="650" ind1=" " ind2="4"> <marc:subfield code="a">Art</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">General works</marc:subfield> <marc:subfield code="x">Historians and critics</marc:subfield> <marc:subfield code="x">Smith, John, 1834-1917</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">Généralités</marc:subfield> <marc:subfield code="x">Historiens et critiques d'art</marc:subfield> <marc:subfield code="x">Dietrichson, Lorentz, 1834-1917</marc:subfield> </marc:datafield> <marc:datafield ind2=" " ind1=" " tag="654"> <marc:subfield code="a">General works</marc:subfield> </marc:datafield> <marc:datafield ind2=" " ind1=" " tag="654"> <marc:subfield code="a">Généralités</marc:subfield> <marc:subfield code="b">Historiens et critiques d'art</marc:subfield> <marc:subfield code="b">Smith, John, 1834-1917</marc:subfield> </marc:datafield> <marc:datafield tag="949" ind1=" " ind2=" "> <marc:subfield code="i">Review of conference proceedings</marc:subfield> </marc:datafield> </marc:record> <marc:record> <marc:datafield tag="035" ind1=" " ind2=" "> <marc:subfield code="a">54321</marc:subfield> </marc:datafield> <marc:datafield tag="041" ind1=" " ind2=" "> <marc:subfield code="a">eng</marc:subfield> </marc:datafield> <marc:datafield tag="650" ind1=" " ind2="4"> <marc:subfield code="a">Byzantine</marc:subfield> </marc:datafield> <marc:datafield ind2="4" ind1=" " tag="650"> <marc:subfield code="a">General works</marc:subfield> <marc:subfield code="x">Historians and critics</marc:subfield> <marc:subfield code="x">Lange, Julius Henrik, 1838-1896</marc:subfield> </marc:datafield> </marc:record> </marc:collection> I've tried using examples that I've found that did lookups, but none of them seemed to work. I didn't include any of my XSL, because all of my results were disasterous. I keep looking at it, like it must be simple, but I'm just not getting any decent results. Any help or pointers would be greatly appreciated. Thanks!

    Read the article

  • How can I copy files with names containing spaces and UNICODE, when using a shell script?

    - by LOlliffe
    I have a list of files that I'm trying to copy and move (using cp and mv) in a bash shell script. The problem that I'm running into, is that I can't get either command to recognize a huge number of files, seemingly because the filenames contain spaces and/or unicode characters. I couldn't find any switches to decode/re-encode these characters. Instead, for example, if I copy "file name.xml", I get "*.xml" and a script error that the file wasn't found for my result. Does anyone know settings or commands that will deal with these files?

    Read the article

  • How do I combine or merge grouped nodes?

    - by LOlliffe
    Using the XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:output method="xml"/> <xsl:template match="/"> <records> <record> <!-- Group record by bigID, for further processing --> <xsl:for-each-group select="records/record" group-by="bigID"> <xsl:sort select="bigID"/> <xsl:for-each select="current-group()"> <!-- Create new combined record --> <bigID> <!-- <xsl:value-of select="."/> --> <xsl:for-each select="."> <xsl:value-of select="bigID"/> </xsl:for-each> </bigID> <text> <xsl:value-of select="text"/> </text> </xsl:for-each> </xsl:for-each-group> </record> </records> </xsl:template> I'm trying to change: <?xml version="1.0" encoding="UTF-8"?> <records> <record> <bigID>123</bigID> <text>Contains text for 123</text> <bigID>456</bigID> <text>Some 456 text</text> <bigID>123</bigID> <text>More 123 text</text> <bigID>123</bigID> <text>Yet more 123 text</text> </record> into: <?xml version="1.0" encoding="UTF-8"?> <records> <record> <bigID>123</bigID> <text>Contains text for 123</text> <text>More 123 text</text> <text>Yet more 123 text</text> </bigID> <bigID>456 <text>Some 456 text</text> </bigID> </record> Right now, I'm just listing the grouped <bigIDs, individually. I'm missing the step after grouping, where I combine the grouped <bigID nodes. My suspicion is that I need to use the "key" function somehow, but I'm not sure. Thanks for any help.

    Read the article

  • How do I prevent duplicates, in XSL?

    - by LOlliffe
    How do I prevent duplicate entries into a list, and then ideally, sort that list? What I'm doing, is when information at one level is missing, taking the information from a level below it, to building the missing list, in the level above. Currently, I have XML similar to this: <c03 id="ref6488" level="file"> <did> <unittitle>Clinic Building</unittitle> <unitdate era="ce" calendar="gregorian">1947</unitdate> </did> <c04 id="ref34582" level="file"> <did> <container label="Box" type="Box">156</container> <container label="Folder" type="Folder">3</container> </did> </c04> <c04 id="ref6540" level="file"> <did> <container label="Box" type="Box">156</container> <unittitle>Contact prints</unittitle> </did> </c04> <c04 id="ref6606" level="file"> <did> <container label="Box" type="Box">154</container> <unittitle>Negatives</unittitle> </did> </c04> </c03> I then apply the following XSL: <xsl:template match="c03/did"> <xsl:choose> <xsl:when test="not(container)"> <did> <!-- If no c03 container item is found, look in the c04 level for one --> <xsl:if test="../c04/did/container"> <!-- If a c04 container item is found, use the info to build a c03 version --> <!-- Skip c03 container item, if still no c04 items found --> <container label="Box" type="Box"> <!-- Build container list --> <!-- Test for more than one item, and if so, list them, --> <!-- separated by commas and a space --> <xsl:for-each select="../c04/did"> <xsl:if test="position() &gt; 1">, </xsl:if> <xsl:value-of select="container"/> </xsl:for-each> </container> </did> </xsl:when> <!-- If there is a c03 container item(s), list it normally --> <xsl:otherwise> <xsl:copy-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> But I'm getting the "container" result of <container label="Box" type="Box">156, 156, 154</container> when what I want is <container label="Box" type="Box">154, 156</container> Below is the full result that I'm trying to get: <c03 id="ref6488" level="file"> <did> <container label="Box" type="Box">154, 156</container> <unittitle>Clinic Building</unittitle> <unitdate era="ce" calendar="gregorian">1947</unitdate> </did> <c04 id="ref34582" level="file"> <did> <container label="Box" type="Box">156</container> <container label="Folder" type="Folder">3</container> </did> </c04> <c04 id="ref6540" level="file"> <did> <container label="Box" type="Box">156</container> <unittitle>Contact prints</unittitle> </did> </c04> <c04 id="ref6606" level="file"> <did> <container label="Box" type="Box">154</container> <unittitle>Negatives</unittitle> </did> </c04> </c03> Thanks in advance for any help!

    Read the article

  • How do I get a Mac ".command" file to automatically quit after running a shell script?

    - by LOlliffe
    In my shell script, my last lines are: ... echo "$l" done done exit I have Terminal preference set to "When the shell exits: Close the window". In all other cases, when I type "exit" or "logout", in Terminal, the window closes, but for this ".command" file (I can double-click on my shell script file, and the script runs), instead of closing the window, while the file's code says "exit", what shows on the screen is: ... $l done logout [Process completed] ...and the window remains open. Does anyone know how to get a shell script to run, and then just automatically quit the Terminal window on completion? Thanks!

    Read the article

  • Iteration, or copying in XSL, based on a count. How do I do it?

    - by LOlliffe
    I'm trying to create an inventory list (tab-delimited text, for the output) from XML data. The catch is, I need to take the line that I created, and list it multiple times (iterate ???), based on a number found in the XML. So, from the XML below: <?xml version="1.0" encoding="UTF-8"?> <library> <aisle label="AA"> <row>bb</row> <shelf>a</shelf> <books>4</books> </aisle> <aisle label="BB"> <row>cc</row> <shelf>d</shelf> <books>3</books> </aisle> </library> I need to take the value found in "books", and then copy the text line that number of times. The result looking like this: Aisle Row Shelf Titles AA bb a AA bb a AA bb a AA bb a BB cc d BB cc d BB cc d So that the inventory taker, can then write in the titles found on each shelf. I have the basic structure of my XSL, but I'm not sure how to do the "iteration" portion. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="2.0"> <xsl:output omit-xml-declaration="yes"/> <xsl:variable name="tab" select="'&#09;'"/> <xsl:variable name="newline" select="'&#10;'"/> <xsl:template match="/"> <!-- Start Spreadsheet header --> <xsl:text>Aisle</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Row</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Shelf</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Titles</xsl:text> <xsl:value-of select="$newline"/> <!-- End spreadsheet header --> <!-- Start entering values from XML --> <xsl:for-each select="library/aisle"> <xsl:value-of select="@label"/> <xsl:value-of select="$tab"/> <xsl:value-of select="row"/> <xsl:value-of select="$tab"/> <xsl:value-of select="shelf"/> <xsl:value-of select="$tab"/> <xsl:value-of select="$tab"/> <xsl:value-of select="$newline"/> </xsl:for-each> <!-- End of values from XML --> <!-- Iteration of the above needed, based on count value in "books" --> </xsl:template> </xsl:stylesheet> Any help would be greatly appreciated. For starters, is "iteration" the right term to be using for this? Thanks!

    Read the article

  • How do I combine grouped nodes?

    - by LOlliffe
    Using the XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:output method="xml"/> <xsl:template match="/"> <records> <record> <!-- Group record by bigID, for further processing --> <xsl:for-each-group select="records/record" group-by="bigID"> <xsl:sort select="bigID"/> <xsl:for-each select="current-group()"> <!-- Create new combined record --> <bigID> <!-- <xsl:value-of select="."/> --> <xsl:for-each select="."> <xsl:value-of select="bigID"/> </xsl:for-each> </bigID> <text> <xsl:value-of select="text"/> </text> </xsl:for-each> </xsl:for-each-group> </record> </records> </xsl:template> I'm trying to change: <?xml version="1.0" encoding="UTF-8"?> <records> <record> <bigID>123</bigID> <text>Contains text for 123</text> <bigID>456</bigID> <text>Some 456 text</text> <bigID>123</bigID> <text>More 123 text</text> <bigID>123</bigID> <text>Yet more 123 text</text> </record> into: <?xml version="1.0" encoding="UTF-8"?> <records> <record> <bigID>123</bigID> <text>Contains text for 123</text> <text>More 123 text</text> <text>Yet more 123 text</text> </bigID> <bigID>456 <text>Some 456 text</text> </bigID> </record> Right now, I'm just listing the grouped <bigIDs, individually. I'm missing the step after grouping, where I combine the grouped <bigID nodes. My suspicion is that I need to use the "key" function somehow, but I'm not sure. Thanks for any help.

    Read the article

  • How do I check for the existence of an external file with XSL?

    - by LOlliffe
    I've found a lot of examples that reference Java and C for this, but how do I, or can I, check for the existence of an external file with XSL. First, I realize that this is only a snippet, but it's part of a huge stylesheet, so I'm hoping it's enough to show my issue. <!-- Use this template for Received SMSs --> <xsl:template name="ReceivedSMS"> <!-- Set/Declare "SMSname" variable (local, evaluates per instance) --> <xsl:variable name="SMSname"> <xsl:value-of select=" following-sibling::Name"/> </xsl:variable> <fo:table font-family="Arial Unicode MS" font-size="8pt" text-align="start"> <fo:table-column column-width=".75in"/> <fo:table-column column-width="6.75in"/> <fo:table-body> <fo:table-row> <!-- Cell contains "speakers" icon --> <fo:table-cell display-align="after"> <fo:block text-align="start"> <fo:external-graphic src="../images/{$SMSname}.jpg" content-height="0.6in"/> What I'd like to do, is put in an "if" statement, surronding the {$SMSname}.jpg line. That is: <fo:block text-align="start"> <xsl:if test="exists( the external file {$SMSname}.jpg)"> <fo:external-graphic src="../images/{$SMSname}.jpg" content-height="0.6in"/> </xsl:if> <xsl:if test="not(exists( the external file {$SMSname}.jpg))"> <fo:external-graphic src="../images/unknown.jpg" content-height="0.6in"/> </xsl:if> </fo:block> Because of "grouping", etc., I'm using XSLT 2.0. I hope that this is something that can be done. I hope even more that it's something simple. As always, thanks in advance for any help. LO

    Read the article

1