mit xslt nach Häufigkeit sortieren

#1
Hallo;-)

dies ist der Auszug meiner XML Datei:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="author3.xsl"?>
<!DOCTYPE PubmedArticleSet PUBLIC "-//NLM//DTD PubMedArticle, 1st May 2013//EN" "http://www.ncbi.nlm.nih.gov/corehtml/query/DTD/pubmed_130501.dtd">
<PubmedArticleSet>
 
<PubmedArticle>
    <MedlineCitation Status="Publisher" Owner="NLM">
        <PMID Version="1">24091937</PMID>
        <DateCreated>
            <Year>2013</Year>
            <Month>10</Month>
            <Day>4</Day>
        </DateCreated>
        <Article PubModel="Print-Electronic">
            <Journal>
                <ISSN IssnType="Electronic">2168-6173</ISSN>
                <JournalIssue CitedMedium="Internet">
                    <PubDate>
                        <Year>2013</Year>
                        <Month>Oct</Month>
                        <Day>3</Day>
                    </PubDate>
                </JournalIssue>
                <Title>JAMA ophthalmology</Title>
                <ISOAbbreviation>JAMA Ophthalmol</ISOAbbreviation>
            </Journal>
            <ArticleTitle>RYR1 Mutations as a Cause of Ophthalmoplegia, Facial Weakness, and Malignant Hyperthermia.</ArticleTitle>
            <Pagination>
                <MedlinePgn/>
            </Pagination>
            <ELocationID EIdType="doi">10.1001/jamaophthalmol.2013.4392</ELocationID>
            <Abstract>
                <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>
            </Abstract>
            <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>
            <AuthorList>
                <Author>
                    <LastName>Shaaban</LastName>
                    <ForeName>Sherin</ForeName>
                    <Initials>S</Initials>
                </Author>
                <Author>
                    <LastName>Ramos-Platt</LastName>
                    <ForeName>Leigh</ForeName>
                    <Initials>L</Initials>
                </Author>
                <Author>
                    <LastName>Gilles</LastName>
                    <ForeName>Floyd H</ForeName>
                    <Initials>FH</Initials>
                </Author>
                <Author>
                    <LastName>Chan</LastName>
                    <ForeName>Wai-Man</ForeName>
                    <Initials>WM</Initials>
                </Author>
                <Author>
                    <LastName>Andrews</LastName>
                    <ForeName>Caroline</ForeName>
                    <Initials>C</Initials>
                </Author>
                <Author>
                    <LastName>De Girolami</LastName>
                    <ForeName>Umberto</ForeName>
                    <Initials>U</Initials>
                </Author>
                <Author>
                    <LastName>Demer</LastName>
                    <ForeName>Joseph</ForeName>
                    <Initials>J</Initials>
                </Author>
                <Author>
                    <LastName>Engle</LastName>
                    <ForeName>Elizabeth C</ForeName>
                    <Initials>EC</Initials>
                </Author>
            </AuthorList>
            <Language>ENG</Language>
            <PublicationTypeList>
                <PublicationType>JOURNAL ARTICLE</PublicationType>
            </PublicationTypeList>
            <ArticleDate DateType="Electronic">
                <Year>2013</Year>
                <Month>10</Month>
                <Day>3</Day>
            </ArticleDate>
        </Article>
        <MedlineJournalInfo>
            <MedlineTA>JAMA Ophthalmol</MedlineTA>
            <NlmUniqueID>101589539</NlmUniqueID>
            <ISSNLinking>2168-6165</ISSNLinking>
        </MedlineJournalInfo>
    </MedlineCitation>
    <PubmedData>
        <History>
            <PubMedPubDate PubStatus="entrez">
                <Year>2013</Year>
                <Month>10</Month>
                <Day>5</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="pubmed">
                <Year>2013</Year>
                <Month>10</Month>
                <Day>5</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="medline">
                <Year>2013</Year>
                <Month>10</Month>
                <Day>5</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
        </History>
        <PublicationStatus>aheadofprint</PublicationStatus>
        <ArticleIdList>
            <ArticleId IdType="pii">1745507</ArticleId>
            <ArticleId IdType="doi">10.1001/jamaophthalmol.2013.4392</ArticleId>
            <ArticleId IdType="pubmed">24091937</ArticleId>
        </ArticleIdList>
    </PubmedData>
</PubmedArticle>
 
 
<PubmedArticle>
    <MedlineCitation Status="Publisher" Owner="NLM">
        <PMID Version="1">24053352</PMID>
        <DateCreated>
            <Year>2013</Year>
            <Month>9</Month>
            <Day>23</Day>
        </DateCreated>
        <Article PubModel="Print-Electronic">
            <Journal>
                <ISSN IssnType="Print">1471-2253</ISSN>
                <JournalIssue CitedMedium="Print">
                    <Volume>13</Volume>
                    <Issue>1</Issue>
                    <PubDate>
                        <Year>2013</Year>
                        <Month>Sep</Month>
                        <Day>23</Day>
                    </PubDate>
                </JournalIssue>
                <Title>BMC anesthesiology</Title>
                <ISOAbbreviation>BMC Anesthesiol</ISOAbbreviation>
            </Journal>
            <ArticleTitle>Evaluation of suspected malignant hyperthermia events during anesthesia.</ArticleTitle>
            <Pagination>
                <MedlinePgn>24</MedlinePgn>
            </Pagination>
            <Abstract>
                <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>
                <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>
                <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>
                <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>
            </Abstract>
            <AuthorList>
                <Author>
                    <LastName>Schuster</LastName>
                    <ForeName>Frank</ForeName>
                    <Initials>F</Initials>
                </Author>
                <Author>
                    <LastName>Johannsen</LastName>
                    <ForeName>Stephan</ForeName>
                    <Initials>S</Initials>
                </Author>
                <Author>
                    <LastName>Schneiderbanger</LastName>
                    <ForeName>Daniel</ForeName>
                    <Initials>D</Initials>
                </Author>
                <Author>
                    <LastName>Roewer</LastName>
                    <ForeName>Norbert</ForeName>
                    <Initials>N</Initials>
                </Author>
            </AuthorList>
            <Language>ENG</Language>
            <PublicationTypeList>
                <PublicationType>JOURNAL ARTICLE</PublicationType>
            </PublicationTypeList>
            <ArticleDate DateType="Electronic">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>23</Day>
            </ArticleDate>
        </Article>
        <MedlineJournalInfo>
            <MedlineTA>BMC Anesthesiol</MedlineTA>
            <NlmUniqueID>100968535</NlmUniqueID>
            <ISSNLinking>1471-2253</ISSNLinking>
        </MedlineJournalInfo>
    </MedlineCitation>
    <PubmedData>
        <History>
            <PubMedPubDate PubStatus="received">
                <Year>2012</Year>
                <Month>11</Month>
                <Day>20</Day>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="accepted">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>23</Day>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="aheadofprint">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>23</Day>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="entrez">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>24</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="pubmed">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>24</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
            <PubMedPubDate PubStatus="medline">
                <Year>2013</Year>
                <Month>9</Month>
                <Day>24</Day>
                <Hour>6</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
        </History>
        <PublicationStatus>aheadofprint</PublicationStatus>
        <ArticleIdList>
            <ArticleId IdType="pii">1471-2253-13-24</ArticleId>
            <ArticleId IdType="doi">10.1186/1471-2253-13-24</ArticleId>
            <ArticleId IdType="pubmed">24053352</ArticleId>
        </ArticleIdList>
    </PubmedData>
</PubmedArticle>
</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:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <html>
            <body>
                <h2>The authors of malignant hyperthermia</h2>
                <table border="1">
                 <tr bgcolor="#9acd32">
                   <th>Authors Lastname</th>
                </tr>
                <xsl:for-each select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author">
                <xsl:sort select="LastName"/>
 
                  <tr>
                    <td>
                        <xsl:value-of select="LastName"/>
                    </td>
      
                </tr>
                 </xsl:for-each>
                </table>
            </body>
        </html>
    </xsl:template>
 
</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
Franky
 

deepthroat

Erfahrenes Mitglied
#2
Hi.

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
So du einen XSLT 2.0 Prozessor wie Saxon 9 benutzen kannst, ersetze
Code:
                <xsl:for-each select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author">
                <xsl:sort select="LastName"/>
 
                  <tr>
                    <td>
                        <xsl:value-of select="LastName"/>
                    </td>
      
                </tr>
                 </xsl:for-each>
durch
Code:
                <xsl:for-each-group select="PubmedArticleSet/PubmedArticle/MedlineCitation/Article/AuthorList/Author" group-by="LastName">
                <xsl:sort select="count(current-group())" order="descending"/>

 
                  <tr>
                    <td>
                        <xsl:value-of select="concat(current-grouping-key(), ': ', count(current-group()))"/>
                    </td>
      
                </tr>
                 </xsl:for-each-group>
 
#4
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****
 
#8
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
Code:
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.
 
#11
Überprüfe mal, ob das "bin"-Unterverzeichnis des Installationsverzeichnisses von Saxon bei dir im Pfad ist, also etwa
Code:
C:\Program Files (x86)\Saxonica\SaxonHE9.5N\bin
Oder du musst halt
Code:
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
also ich habe in das verzeichnis


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

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:
#15
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:
C:\Program files\Saxonica\SaxonHE9.5N\bin\transform.exe -s:pubmed_result.xml -xsl:newauthor.xsl -o:result.html
auf.
 
#16
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?