XSLT from 2 XMLs -


i'm new xslt advanced program. have doubt in making xslt 2 different xml files.

below 2 xml files have.

ahk-authors.xml

    <?xml version="1.0" encoding="utf-8"?> <chapters>     <chapter no="1">         <head-4>by j. r. weeramantry</head-4>     </chapter>     <chapter no="2">         <head-4>by ernest yang<footnote id="ahk-02.1.fn0" prefix="*">                 <footnote-para>i acknowledge , express gratitude assistance provided colleagues, mr. kevin hong , ms. sharon leung, in preparation of chapter. errors , omissions own. </footnote-para>             </footnote>         </head-4>     </chapter>     <chapter no="3">         <head-4>by david bateson , edmund wan</head-4>     </chapter>     <chapter no="4">         <head-4>by timothy hill , mark lin</head-4>     </chapter>     <chapter no="5">         <head-4>by christopher to<footnote id="ahk-05.1.fn0" prefix="*">                 <footnote-para>i acknowledge alan tang siu lun assistance in compiling parts of chapter.</footnote-para>             </footnote>         </head-4>     </chapter>     <chapter no="6">         <head-4>by chiann bao</head-4>     </chapter>     <chapter no="7">         <head-4>by justin d’agostino , ula cartwright-finch</head-4>     </chapter>     <chapter no="8">         <head-4>by kim m. rooney</head-4>     </chapter>     <chapter no="9">         <head-4>by neil kaplan qc, jp, cbe, sbs , andrew aglionby</head-4>         <head-5>[revised , updated william stone qc, sbs]<footnote id="ahk-09.1.fn0" prefix="*">                 <footnote-para>with summer students chadwick wong , cheryl leung.</footnote-para>             </footnote>         </head-5>     </chapter>     <chapter no="10">         <head-4>by frances van eupen</head-4>     </chapter>     <chapter no="11">         <head-4>by peter yuen , john choong</head-4>     </chapter>     <chapter no="12">         <head-4>by david bateson , edmund wan</head-4>     </chapter>     <chapter no="13">         <head-4>by teresa cheng sc<footnote id="ahk-13.1.fn0" prefix="*">                 <footnote-para>special andrew aglionby, joy medd , johnson tan, co-authors first edition of chapter, portions of work has been retained herein.</footnote-para>             </footnote>         </head-4>     </chapter>     <chapter no="14">         <head-4>by paul starr<footnote id="ahk-14.1.fn0" prefix="*">                 <footnote-para>heartfelt jennifer lee-shoy, stefania lucchetti, samuel tang , rita wong.</footnote-para>             </footnote>         </head-4>     </chapter>     <chapter no="15">         <head-4>by timothy hill , mark lin</head-4>     </chapter>     <chapter no="16">         <head-4>by denis brock , shirley wu</head-4>     </chapter>     <chapter no="17">         <head-4>by peter chow</head-4>     </chapter>     <chapter no="18">         <head-4>by paul starr<footnote id="ahk-18.1.fn0" prefix="*">                 <footnote-para>heartfelt jennifer lee-shoy, samuel tang , rita wong assistance chapter.</footnote-para>             </footnote>         </head-4>     </chapter>     <chapter no="19">         <head-4>by kathryn sanger, joseph chu , bing yu</head-4>     </chapter>     <chapter no="20">         <head-4>by loke-khoon tan</head-4>     </chapter>     <chapter no="21">         <head-4>by philip yang , rosita lau</head-4>     </chapter>     <chapter no="22">         <head-4>by marianne chao</head-4>     </chapter>     <chapter no="23">         <head-4>by dr nils eliasson</head-4>     </chapter>     <chapter no="24">         <head-4>banking, international investor-state, insurance, property , employment disputes</head-4>         <head-5>by frances van eupen, vincent li, gary soo , alexander stock</head-5>     </chapter> </chapters> 

arbhk-chapter01.xml

    <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="xsl" ref="untitled28.xslt"?> <chapter num="a">     <title>         <content-style font-style="bold">part 1 general principles</content-style>     </title>     <section level="sect1">         <title>             <content-style font-style="bold">chapter 1: new arbitration ordinance</content-style>         </title>     </section> </chapter> 

and xslt tried below untitled28.xslt

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:fn="http://www.w3.org/2005/xpath-functions">     <xsl:output method="html" encoding="utf-8" indent="yes"/>     <xsl:template match="/">          <html>             <head>                 <xsl:text disable-output-escaping="yes"><![cdata[</meta>]]></xsl:text>                 <title>                     <xsl:value-of select="substring-after(chapter/section/title,':')"/>                 </title>                 <link rel="stylesheet" href="er:#css" type="text/css"/><xsl:text disable-output-escaping="yes"><![cdata[</link>]]></xsl:text>             </head>             <body>                 <xsl:call-template name="new"/>             </body>         </html>     </xsl:template>  <xsl:template match="chapters/chapter" name="new"> <div class="new"> <xsl:apply-templates select="document('ahk-authors.xml')/head-4"> </xsl:apply-templates> </div> </xsl:template>  </xsl:stylesheet> 

the o/p i'm getting below

<html>     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8">     </meta>         <title> new arbitration ordinance</title>         <link rel="stylesheet" href="er:#css" type="text/css"/>     </head>     <body>         <div class="new"/>     </body> </html> 

but want list authors information.

please let me know how do it.

thanks

check xpath in directing looking "/head-4", must put document element or put // slash instead of 1 should work


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -