1. Diese Seite verwendet Cookies. Wenn du dich weiterhin auf dieser Seite aufhältst, akzeptierst du unseren Einsatz von Cookies. Weitere Informationen

mit xslt nach Häufigkeit sortieren

Dieses Thema im Forum "XML Technologien" wurde erstellt von franky2008, 24. Oktober 2013.

  1. franky2008

    franky2008 Grünschnabel


    dies ist der Auszug meiner XML Datei:

    Code (Text):
    1. <?xml version="1.0" encoding="ISO-8859-1"?>
    2. <?xml-stylesheet type="text/xsl" href="author3.xsl"?>
    3. <!DOCTYPE PubmedArticleSet PUBLIC "-//NLM//DTD PubMedArticle, 1st May 2013//EN" "http://www.ncbi.nlm.nih.gov/corehtml/query/DTD/pubmed_130501.dtd">
    4. <PubmedArticleSet>
    6. <PubmedArticle>
    7.     <MedlineCitation Status="Publisher" Owner="NLM">
    8.         <PMID Version="1">24091937</PMID>
    9.         <DateCreated>
    10.             <Year>2013</Year>
    11.             <Month>10</Month>
    12.             <Day>4</Day>
    13.         </DateCreated>
    14.         <Article PubModel="Print-Electronic">
    15.             <Journal>
    16.                 <ISSN IssnType="Electronic">2168-6173</ISSN>
    17.                 <JournalIssue CitedMedium="Internet">
    18.                     <PubDate>
    19.                         <Year>2013</Year>
    20.                         <Month>Oct</Month>
    21.                         <Day>3</Day>
    22.                     </PubDate>
    23.                 </JournalIssue>
    24.                 <Title>JAMA ophthalmology</Title>
    25.                 <ISOAbbreviation>JAMA Ophthalmol</ISOAbbreviation>
    26.             </Journal>
    27.             <ArticleTitle>RYR1 Mutations as a Cause of Ophthalmoplegia, Facial Weakness, and Malignant Hyperthermia.</ArticleTitle>
    28.             <Pagination>
    29.                 <MedlinePgn/>
    30.             </Pagination>
    31.             <ELocationID EIdType="doi">10.1001/jamaophthalmol.2013.4392</ELocationID>
    32.             <Abstract>
    33.                 <AbstractText NlmCategory="UNLABELLED">IMPORTANCE Total ophthalmoplegia can result from ryanodine receptor 1 (RYR1) mutations without overt associated skeletal myopathy. Patients carrying RYR1 mutations are at high risk of developing malignant hyperthermia. Ophthalmologists should be familiar with these important clinical associations. OBJECTIVE To determine the genetic cause of congenital ptosis, ophthalmoplegia, facial paralysis, and mild hypotonia segregating in 2 pedigrees diagnosed with atypical Moebius syndrome or congenital fibrosis of the extraocular muscles. DESIGN, SETTING, AND PARTICIPANTS Clinical data including medical and family histories were collected at research laboratories at Boston Children's Hospital and Jules Stein Eye Institute (Engle and Demer labs) for affected and unaffected family members from 2 pedigrees in which patients presented with total ophthalmoplegia, facial weakness, and myopathy. INTERVENTION Homozygosity mapping and whole-exome sequencing were conducted to identify causative mutations in affected family members. Histories, physical examinations, and clinical data were reviewed. MAIN OUTCOME AND MEASURE Mutations in RYR1. RESULTS Missense mutations resulting in 2 homozygous RYR1 amino acid substitutions (E989G and R3772W) and 2 compound heterozygous RYR1 substitutions (H283R and R3772W) were identified in a consanguineous and a nonconsanguineous pedigree, respectively. Orbital magnetic resonance imaging revealed marked hypoplasia of extraocular muscles and intraorbital cranial nerves. Skeletal muscle biopsy specimens revealed nonspecific myopathic changes. Clinically, the patients' ophthalmoplegia and facial weakness were far more significant than their hypotonia and limb weakness and were accompanied by an unrecognized susceptibility to malignant hyperthermia. CONCLUSIONS AND RELEVANCE Affected children presenting with severe congenital ophthalmoplegia and facial weakness in the setting of only mild skeletal myopathy harbored recessive mutations in RYR1, encoding the ryanodine receptor 1, and were susceptible to malignant hyperthermia. While ophthalmoplegia occurs rarely in RYR1-related myopathies, these children were atypical because they lacked significant weakness, respiratory insufficiency, or scoliosis. RYR1-associated myopathies should be included in the differential diagnosis of congenital ophthalmoplegia and facial weakness, even without clinical skeletal myopathy. These patients should also be considered susceptible to malignant hyperthermia, a life-threatening anesthetic complication avoidable if anticipated presurgically.</AbstractText>
    34.             </Abstract>
    35.             <Affiliation>Department of Neurology, Boston Children's Hospital, Boston, Massachusetts2F. B. Kirby Neurobiology Center, Boston Children's Hospital, Boston, Massachusetts3Program in Genomics, Boston Children's Hospital, Boston, Massachusetts4Manton Center for Orphan Disease Research, Boston Children's Hospital, Boston, Massachusetts5Dubai Harvard Foundation for Medical Research, Boston, Massachusetts.</Affiliation>
    36.             <AuthorList>
    37.                 <Author>
    38.                     <LastName>Shaaban</LastName>
    39.                     <ForeName>Sherin</ForeName>
    40.                     <Initials>S</Initials>
    41.                 </Author>
    42.                 <Author>
    43.                     <LastName>Ramos-Platt</LastName>
    44.                     <ForeName>Leigh</ForeName>
    45.                     <Initials>L</Initials>
    46.                 </Author>
    47.                 <Author>
    48.                     <LastName>Gilles</LastName>
    49.                     <ForeName>Floyd H</ForeName>
    50.                     <Initials>FH</Initials>
    51.                 </Author>
    52.                 <Author>
    53.                     <LastName>Chan</LastName>
    54.                     <ForeName>Wai-Man</ForeName>
    55.                     <Initials>WM</Initials>
    56.                 </Author>
    57.                 <Author>
    58.                     <LastName>Andrews</LastName>
    59.                     <ForeName>Caroline</ForeName>
    60.                     <Initials>C</Initials>
    61.                 </Author>
    62.                 <Author>
    63.                     <LastName>De Girolami</LastName>
    64.                     <ForeName>Umberto</ForeName>
    65.                     <Initials>U</Initials>
    66.                 </Author>
    67.                 <Author>
    68.                     <LastName>Demer</LastName>
    69.                     <ForeName>Joseph</ForeName>
    70.                     <Initials>J</Initials>
    71.                 </Author>
    72.                 <Author>
    73.                     <LastName>Engle</LastName>
    74.                     <ForeName>Elizabeth C</ForeName>
    75.                     <Initials>EC</Initials>
    76.                 </Author>
    77.             </AuthorList>
    78.             <Language>ENG</Language>
    79.             <PublicationTypeList>
    80.                 <PublicationType>JOURNAL ARTICLE</PublicationType>
    81.             </PublicationTypeList>
    82.             <ArticleDate DateType="Electronic">
    83.                 <Year>2013</Year>
    84.                 <Month>10</Month>
    85.                 <Day>3</Day>
    86.             </ArticleDate>
    87.         </Article>
    88.         <MedlineJournalInfo>
    89.             <MedlineTA>JAMA Ophthalmol</MedlineTA>
    90.             <NlmUniqueID>101589539</NlmUniqueID>
    91.             <ISSNLinking>2168-6165</ISSNLinking>
    92.         </MedlineJournalInfo>
    93.     </MedlineCitation>
    94.     <PubmedData>
    95.         <History>
    96.             <PubMedPubDate PubStatus="entrez">
    97.                 <Year>2013</Year>
    98.                 <Month>10</Month>
    99.                 <Day>5</Day>
    100.                 <Hour>6</Hour>
    101.                 <Minute>0</Minute>
    102.             </PubMedPubDate>
    103.             <PubMedPubDate PubStatus="pubmed">
    104.                 <Year>2013</Year>
    105.                 <Month>10</Month>
    106.                 <Day>5</Day>
    107.                 <Hour>6</Hour>
    108.                 <Minute>0</Minute>
    109.             </PubMedPubDate>
    110.             <PubMedPubDate PubStatus="medline">
    111.                 <Year>2013</Year>
    112.                 <Month>10</Month>
    113.                 <Day>5</Day>
    114.                 <Hour>6</Hour>
    115.                 <Minute>0</Minute>
    116.             </PubMedPubDate>
    117.         </History>
    118.         <PublicationStatus>aheadofprint</PublicationStatus>
    119.         <ArticleIdList>
    120.             <ArticleId IdType="pii">1745507</ArticleId>
    121.             <ArticleId IdType="doi">10.1001/jamaophthalmol.2013.4392</ArticleId>
    122.             <ArticleId IdType="pubmed">24091937</ArticleId>
    123.         </ArticleIdList>
    124.     </PubmedData>
    125. </PubmedArticle>
    128. <PubmedArticle>
    129.     <MedlineCitation Status="Publisher" Owner="NLM">
    130.         <PMID Version="1">24053352</PMID>
    131.         <DateCreated>
    132.             <Year>2013</Year>
    133.             <Month>9</Month>
    134.             <Day>23</Day>
    135.         </DateCreated>
    136.         <Article PubModel="Print-Electronic">
    137.             <Journal>
    138.                 <ISSN IssnType="Print">1471-2253</ISSN>
    139.                 <JournalIssue CitedMedium="Print">
    140.                     <Volume>13</Volume>
    141.                     <Issue>1</Issue>
    142.                     <PubDate>
    143.                         <Year>2013</Year>
    144.                         <Month>Sep</Month>
    145.                         <Day>23</Day>
    146.                     </PubDate>
    147.                 </JournalIssue>
    148.                 <Title>BMC anesthesiology</Title>
    149.                 <ISOAbbreviation>BMC Anesthesiol</ISOAbbreviation>
    150.             </Journal>
    151.             <ArticleTitle>Evaluation of suspected malignant hyperthermia events during anesthesia.</ArticleTitle>
    152.             <Pagination>
    153.                 <MedlinePgn>24</MedlinePgn>
    154.             </Pagination>
    155.             <Abstract>
    156.                 <AbstractText Label="BACKGROUND" NlmCategory="BACKGROUND">Malignant hyperthermia (MH), a metabolic myopathy triggered by volatile anesthetics and depolarizing muscle relaxants, is a potentially lethal complication of general anesthesia in susceptible patients. The implementation of modern inhalation anesthetics that research indicates as less potent trigger substances and the recommended limitations of succinylcholine use, suggests there may be considerable decline of fulminant MH cases. In the presented study, the authors analyzed suspected MH episodes during general anesthesia of patients that were referred to the Wuerzburg MH unit between 2007 and 2011, assuming that MH is still a relevant anesthetic problem in our days.</AbstractText>
    157.                 <AbstractText Label="METHODS" NlmCategory="METHODS">With approval of the local ethics committee data of patients that underwent muscle biopsy and in vitro contracture test (IVCT) between 2007 and 2011 were analyzed. Only patients with a history of suspected MH crisis were included in the study. The incidents were evaluated retrospectively using anesthetic documentation and medical records.</AbstractText>
    158.                 <AbstractText Label="RESULTS" NlmCategory="RESULTS">Between 2007 and 2011 a total of 124 patients were tested. 19 of them were referred because of suspected MH events; 7 patients were diagnosed MH-susceptible, 4 MH-equivocal and 8 MH-non-susceptible by IVCT. In a majority of cases masseter spasm after succinylcholine had been the primary symptom. Cardiac arrhythmias and hypercapnia frequently occurred early in the course of events. Interestingly, dantrolene treatment was initiated in a few cases only.</AbstractText>
    159.                 <AbstractText Label="CONCLUSIONS" NlmCategory="CONCLUSIONS">MH is still an important anesthetic complication. Every anesthetist must be aware of this life-threatening syndrome at any time. The rapid onset of adequate therapy is crucial to avoid major harm and possibly lethal outcome. Dantrolene must be readily available wherever MH triggering agents are used for anesthesia.</AbstractText>
    160.             </Abstract>
    161.             <AuthorList>
    162.                 <Author>
    163.                     <LastName>Schuster</LastName>
    164.                     <ForeName>Frank</ForeName>
    165.                     <Initials>F</Initials>
    166.                 </Author>
    167.                 <Author>
    168.                     <LastName>Johannsen</LastName>
    169.                     <ForeName>Stephan</ForeName>
    170.                     <Initials>S</Initials>
    171.                 </Author>
    172.                 <Author>
    173.                     <LastName>Schneiderbanger</LastName>
    174.                     <ForeName>Daniel</ForeName>
    175.                     <Initials>D</Initials>
    176.                 </Author>
    177.                 <Author>
    178.                     <LastName>Roewer</LastName>
    179.                     <ForeName>Norbert</ForeName>
    180.                     <Initials>N</Initials>
    181.                 </Author>
    182.             </AuthorList>
    183.             <Language>ENG</Language>
    184.             <PublicationTypeList>
    185.                 <PublicationType>JOURNAL ARTICLE</PublicationType>
    186.             </PublicationTypeList>
    187.             <ArticleDate DateType="Electronic">
    188.                 <Year>2013</Year>
    189.                 <Month>9</Month>
    190.                 <Day>23</Day>
    191.             </ArticleDate>
    192.         </Article>
    193.         <MedlineJournalInfo>
    194.             <MedlineTA>BMC Anesthesiol</MedlineTA>
    195.             <NlmUniqueID>100968535</NlmUniqueID>
    196.             <ISSNLinking>1471-2253</ISSNLinking>
    197.         </MedlineJournalInfo>
    198.     </MedlineCitation>
    199.     <PubmedData>
    200.         <History>
    201.             <PubMedPubDate PubStatus="received">
    202.                 <Year>2012</Year>
    203.                 <Month>11</Month>
    204.                 <Day>20</Day>
    205.             </PubMedPubDate>
    206.             <PubMedPubDate PubStatus="accepted">
    207.                 <Year>2013</Year>
    208.                 <Month>9</Month>
    209.                 <Day>23</Day>
    210.             </PubMedPubDate>
    211.             <PubMedPubDate PubStatus="aheadofprint">
    212.                 <Year>2013</Year>
    213.                 <Month>9</Month>
    214.                 <Day>23</Day>
    215.             </PubMedPubDate>
    216.             <PubMedPubDate PubStatus="entrez">
    217.                 <Year>2013</Year>
    218.                 <Month>9</Month>
    219.                 <Day>24</Day>
    220.                 <Hour>6</Hour>
    221.                 <Minute>0</Minute>
    222.             </PubMedPubDate>
    223.             <PubMedPubDate PubStatus="pubmed">
    224.                 <Year>2013</Year>
    225.                 <Month>9</Month>
    226.                 <Day>24</Day>
    227.                 <Hour>6</Hour>
    228.                 <Minute>0</Minute>
    229.             </PubMedPubDate>
    230.             <PubMedPubDate PubStatus="medline">
    231.                 <Year>2013</Year>
    232.                 <Month>9</Month>
    233.                 <Day>24</Day>
    234.                 <Hour>6</Hour>
    235.                 <Minute>0</Minute>
    236.             </PubMedPubDate>
    237.         </History>
    238.         <PublicationStatus>aheadofprint</PublicationStatus>
    239.         <ArticleIdList>
    240.             <ArticleId IdType="pii">1471-2253-13-24</ArticleId>
    241.             <ArticleId IdType="doi">10.1186/1471-2253-13-24</ArticleId>
    242.             <ArticleId IdType="pubmed">24053352</ArticleId>
    243.         </ArticleIdList>
    244.     </PubmedData>
    245. </PubmedArticle>
    246. </PubmedArticleSet>
    PubmedArticleSet wiederholt sich öfters in der ganzen XML Datei. Deshalb tauchen die Autoren mehr als einmal auf. Um die Autoren zu sortieren habe ich eine XSLT Datei geschrieben.

    Code (Text):
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    3.     <xsl:template match="/">
    4.         <html>
    5.             <body>
    6.                 <h2>The authors of malignant hyperthermia</h2>
    7.                 <table border="1">
    8.                  <tr bgcolor="#9acd32">
    9.                    <th>Authors Lastname</th>
    10.                 </tr>
    11.                 <xsl:for-each select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author">
    12.                 <xsl:sort select="LastName"/>
    14.                   <tr>
    15.                     <td>
    16.                         <xsl:value-of select="LastName"/>
    17.                     </td>
    19.                 </tr>
    20.                  </xsl:for-each>
    21.                 </table>
    22.             </body>
    23.         </html>
    24.     </xsl:template>
    26. </xsl:stylesheet>
    Mir werden dabei die Autoren nach Nachname sortiert ausgegeben. Da aber einige mehr als einmal vorkommen möchte ich nach Häufigkeit sortieren.
    Gibt es eine Möglichkeit wie ich das realisieren könnte.

    Liebe Grüße
  2. deepthroat

    deepthroat Erfahrenes Mitglied


    So ganz klar ist mir nicht was du überhaupt willst.

    In der Datei sind mehrere PubmedArticle (nicht PubmedArticleSet, richtig?) Elemente enhalten.

    Von diesen willst du alle Autoren ermitteln und dann diese Liste ausgeben?

    Dabei soll jeder Autor nur 1 mal genannt werden?

    Und die Liste soll nach Häufigkeit des Auftretens des Autors sortiert sein?

    Hast du nur XSL 1 oder kannst du auch XSL 2 nutzen?
  3. Martin Honnen

    Martin Honnen Mitglied

    So du einen XSLT 2.0 Prozessor wie Saxon 9 benutzen kannst, ersetze
    Code (Text):
    1.                 <xsl:for-each select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author">
    2.                 <xsl:sort select="LastName"/>
    4.                   <tr>
    5.                     <td>
    6.                         <xsl:value-of select="LastName"/>
    7.                     </td>
    9.                 </tr>
    10.                  </xsl:for-each>
    Code (Text):
    1.                 <xsl:for-each-group select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author" group-by="LastName">
    2.                 <xsl:sort select="count(current-group())" order="descending"/>
    5.                   <tr>
    6.                     <td>
    7.                         <xsl:value-of select="concat(current-grouping-key(), ': ', count(current-group()))"/>
    8.                     </td>
    10.                 </tr>
    11.                  </xsl:for-each-group>
  4. franky2008

    franky2008 Grünschnabel

    ups genau nicht pubmedarticleset sondern pubmedarticle wiederholt sich. ich darf eigentlich nutzen was ich will. Die Frage ist nur wie ich xsl2 benutzen kann****

    muss ich dafür was neues runterladen oder an dem code ändern****
  5. Martin Honnen

    Martin Honnen Mitglied

  6. franky2008

    franky2008 Grünschnabel

    muss ich saxon for java oder saxon for net runterladen?
  7. Martin Honnen

    Martin Honnen Mitglied

    So du mit Windows arbeitest, wo Microsoft den .NET Framework mit Vista/Windows 7/8 zum Teil des Betriebssystem gemacht hat, kannst du die .NET-Version von Saxon nehmen. Die Doku ist unter http://saxonica.com/documentation/html/dotnet/.
    Ansonsten nimm die Java-Version, so nicht vorhanden, musst du aber erst die Oracle Java JRE installieren: http://www.java.com/de/
  8. franky2008

    franky2008 Grünschnabel

    ich habe die NET version runtergeladet und den XSLT code geändert wie du es oben beschrieben hast. Wie kann ich nun die datei in cmd aufrufen? hab mich in die doku reingelesen aber nicht ganz verstanden
  9. Martin Honnen

    Martin Honnen Mitglied

    Code (Text):
    1. transform.exe -s:datei.xml -xsl:xsltdatei.xsl
    sollte von der Eingabeaufforderung reichen. "datei.xml" ist dabei der Name deines XML-Dokumentes, "xsltdatei.xsl" der Name der XSLT-Datei.
  10. franky2008

    franky2008 Grünschnabel

    es kommt die Fehlermeldung
    Der Befehl transform.exe ist entweder falsch geschrieben oder konnte nicht gefunden werden
  11. Martin Honnen

    Martin Honnen Mitglied

    Überprüfe mal, ob das "bin"-Unterverzeichnis des Installationsverzeichnisses von Saxon bei dir im Pfad ist, also etwa
    Code (Text):
    1. C:\Program Files (x86)\Saxonica\SaxonHE9.5N\bin
    Oder du musst halt
    Code (Text):
    1. C:\Program Files (x86)\Saxonica\SaxonHE9.5N\bin\transform.exe ...
    aufrufen. Der Pfad ist nur ein Beispiel, suche mal, wo du Saxon installiert hast.
  12. franky2008

    franky2008 Grünschnabel

    also ich habe in das verzeichnis

    C:\Program Files (x86)\Saxonica\SaxonHE9.5N\bin

    dort habe ich
    transform.exe -s:pubmed_result.xml -xsl:newauthor.xsl
    eingegeben (xml und xsl datei sind auch im saxonica\... Verzeichnis

    jetzt kommt im cmd fenster ein html aber wie kann ich dass denn im Internetexplorer ausgeben?
    also ich mein wie beim xslt 1.0

    außerdem kann ich irgendwie im cmd fenster nicht die komplette html datei sehen.
    Zuletzt bearbeitet: 27. Oktober 2013
  13. Martin Honnen

    Martin Honnen Mitglied

    Mit der Option
    Code (Text):
    1. transform.exe -s:pubmed_result.xml -xsl:newauthor.xsl -o:result.html
    wird eine Datei "result.html" erzeugt, die kannst du dann im Browser laden.
  14. franky2008

    franky2008 Grünschnabel

    Das hab ich probiert nun folgt die Fehlermeldung
    Der zugriff auf den Pfad C:\Program files\Saxonica\SaxonHE9.5N\bin\result.html wurde verweigert
  15. Martin Honnen

    Martin Honnen Mitglied

    Packe die XML und XSLT-Dateien in ein normales Verzeichnis, da wirst du dann auch das Resultat problemlos erzeugen können. Rufe dann Saxon per
    Code (Text):
    1. C:\Program files\Saxonica\SaxonHE9.5N\bin\transform.exe -s:pubmed_result.xml -xsl:newauthor.xsl -o:result.html
  16. franky2008

    franky2008 Grünschnabel

    Habe es einfach in einem anderen Verzeichnis erstellt. Und es hat geklappt.

    Vielen lieben Dank. Oh mein Gott was für erleichterndes Gefühl endlich das Resultat zu sehen :)

    Noch eine letzte Frage ich möchte gerne das Ergebnis in eine Datenbank speichern z.b Access. Ist das Möglich?
  17. Martin Honnen

    Martin Honnen Mitglied

    Möglich ist mit entsprechenden Kenntnissen und entsprechendem Aufwand vieles. Aber mit Access kenne ich mich wenig aus, da muss dir dann jemand anderes helfen.
Die Seite wird geladen...