[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: sorting and multiple output documents in xslt 2.0

Subject: Re: sorting and multiple output documents in xslt 2.0
From: Meghan Finch <meghan.finch@xxxxxxxxx>
Date: Fri, 29 Jul 2011 14:55:57 -0400
Re:  sorting and multiple output documents in xslt 2.0
Wolfhart,

Thank you so much for looking at this. That worked perfectly for what
I need. Thanks to everyone that took a look.

--Meghan

On Fri, Jul 29, 2011 at 2:52 PM, Wolfhart Totschnig
<wolfhart@xxxxxxxxxxxxx> wrote:
> Hi,
>
> From what I can see, you need to replace
>
> <xsl:copy-of select="DISS_submission/DISS_description[@type='masters']"/>
>
> with
>
> <xsl:copy-of select="DISS_submission[DISS_description/@type='masters']"/>
>
>
> Wolfhart
>
>
> Meghan Finch wrote:
>>
>> Hello,
>>
>> I am new to the listserv and was hoping that I could find some help. I
>> am working on a transformation that will take xml that describes
>> theses and dissertations and produce two different xml outputs, one
>> with all of the theses and the other with all of the dissertations.
>> This is an example of a single thesis/dissertation xml record:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <DISS_submission publishing_option="0" embargo_code="0"
>> third_party_search="Y" third_party_sales="N">
>>   <DISS_authorship>
>>       <DISS_author type="primary">
>>           <DISS_name>
>>               <DISS_surname></DISS_surname>
>>               <DISS_fname></DISS_fname>
>>               <DISS_middle/>
>>               <DISS_suffix/>
>>               <DISS_affiliation></DISS_affiliation>
>>           </DISS_name>
>>           <DISS_contact type="current">
>>               <DISS_contact_effdt></DISS_contact_effdt>
>>               <DISS_address>
>>                   <DISS_addrline></DISS_addrline>
>>                   <DISS_addrline></DISS_addrline>
>>                   <DISS_city></DISS_city>
>>                   <DISS_st></DISS_st>
>>                   <DISS_pcode></DISS_pcode>
>>                   <DISS_country></DISS_country>
>>               </DISS_address>
>>               <DISS_email></DISS_email>
>>           </DISS_contact>
>>           <DISS_contact type="future">
>>               <DISS_contact_effdt></DISS_contact_effdt>
>>               <DISS_address>
>>                   <DISS_addrline></DISS_addrline>
>>                   <DISS_addrline></DISS_addrline>
>>                   <DISS_city></DISS_city>
>>                   <DISS_st></DISS_st>
>>                   <DISS_pcode></DISS_pcode>
>>                   <DISS_country></DISS_country>
>>               </DISS_address>
>>               <DISS_email></DISS_email>
>>           </DISS_contact>
>>           <DISS_citizenship></DISS_citizenship>
>>       </DISS_author>
>>   </DISS_authorship>
>>   <DISS_description page_count="115" type="doctoral"
>> external_id="http://id.pdf" apply_for_copyright="no">
>>       <DISS_title></DISS_title>
>>       <DISS_dates>
>>           <DISS_comp_date></DISS_comp_date>
>>           <DISS_accept_date></DISS_accept_date>
>>       </DISS_dates>
>>       <DISS_degree></DISS_degree>
>>       <DISS_institution>
>>           <DISS_inst_code></DISS_inst_code>
>>           <DISS_inst_name></DISS_inst_name>
>>           <DISS_inst_contact></DISS_inst_contact>
>>           <DISS_processing_code></DISS_processing_code>
>>       </DISS_institution>
>>       <DISS_advisor>
>>           <DISS_name>
>>               <DISS_surname></DISS_surname>
>>               <DISS_fname></DISS_fname>
>>               <DISS_middle></DISS_middle>
>>           </DISS_name>
>>       </DISS_advisor>
>>       <DISS_cmte_member>
>>           <DISS_name>
>>               <DISS_surname></DISS_surname>
>>               <DISS_fname></DISS_fname>
>>               <DISS_middle/>
>>               <DISS_suffix/>
>>               <DISS_affiliation/>
>>           </DISS_name>
>>       </DISS_cmte_member>
>>       <DISS_cmte_member>
>>           <DISS_name>
>>               <DISS_surname></DISS_surname>
>>               <DISS_fname></DISS_fname>
>>               <DISS_middle/>
>>               <DISS_suffix/>
>>               <DISS_affiliation/>
>>           </DISS_name>
>>       </DISS_cmte_member>
>>       <DISS_cmte_member>
>>           <DISS_name>
>>               <DISS_surname></DISS_surname>
>>               <DISS_fname></DISS_fname>
>>               <DISS_middle/>
>>               <DISS_suffix/>
>>               <DISS_affiliation/>
>>           </DISS_name>
>>       </DISS_cmte_member>
>>       <DISS_categorization>
>>           <DISS_category>
>>               <DISS_cat_code></DISS_cat_code>
>>               <DISS_cat_desc></DISS_cat_desc>
>>           </DISS_category>
>>           <DISS_keyword/>
>>           <DISS_language></DISS_language>
>>       </DISS_categorization>
>>   </DISS_description>
>>   <DISS_content>
>>       <DISS_abstract>
>>           <DISS_para></DISS_para>
>>       </DISS_abstract>
>>       <DISS_binary type="PDF"></DISS_binary>
>>   </DISS_content>
>>   <DISS_restriction/>
>> </DISS_submission>
>>
>> There are 3 elements inside DISS_submission that are important:
>> DISS_authorship, DISS_description, and DISS_content. Here is the xsl
>> that Ive been trying so far:
>>
>> <xsl:stylesheet version="2.0"
>>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>   xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>   <xsl:output method="xml" indent="yes"/>
>>
>> <xsl:template match="xml">
>>   <xsl:result-document href="masters.xml">
>>
>>       <xsl:if test="DISS_submission/DISS_description[@type='masters']">
>>           <xsl:copy-of
>> select="DISS_submission/DISS_description[@type='masters']"/>
>>       </xsl:if>
>>
>>   </xsl:result-document>
>>   <xsl:result-document href="doctoral.xml">
>>
>>       <xsl:if test="DISS_submission/DISS_description[@type='doctoral']">
>>        <xsl:copy-of
>> select="DISS_submission/DISS_description[@type='doctoral']"/>
>>       </xsl:if>
>>
>>   </xsl:result-document>
>>   </xsl:template></xsl:stylesheet>
>>
>> This does actually create two outputs, one for masters and one for
>> theses. However, it only copies the DISS_description element and its
>> children. I want the entire DISS_submission to be copied. Ive tried
>> replacing xsl:copy-of to just DISS_submission but that just creates
>> two new documents with all of the DISS_submission s, not a sort
>> between masters and doctoral.
>>
>> Im fairly new to xsl and not really a programmer, so forgive me
>> please for any obvious oversights here. XPATH also tends to give me a
>> lot of difficulty, so it could be something simple in there to fix.
>> I'm using Saxon to complete the transform. Thank you for the help and
>> feedback.
>>
>> --Meghan Finch

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.