[xsl] RE: XML to HTML

Subject: [xsl] RE: XML to HTML
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Tue, 20 Sep 2005 13:33:45 +0530
Hi,

 

By using below tempalte I am get the output but with some other content
which i don't want. I have to display TopicGroup title in h1 and the rest of
the child element src values in h2 under that particular topicgroup.

 

To be more clear here is the template xml file, it's quite complex:

 

<?xml version="1.0" encoding="UTF-8"?>

<qxf xmlns:tm="urn:xmlintl-tm-tags">

      <metadata>

            <doc_name origin="GCMS|Standalone|XLIFF"
url="http://cms.abcd.com"; src_path="/blah/blah"
process_cdata="yes|no">document1.xml</doc_name>

            <source lang="en_US">English (US)</source>

            <target lang="de_DE">German (Germany)</target>

            <entities>Define handling of character entities and custom
defined entities... you iterate through the DTD and gather these defintions
.. only used for runtime display in tooltips ... ll entities within segments
are escaped .. ie .. the &amp;  symbol is replaced with &amp;amp;</entities>

      </metadata>

      <docmain>

            <!-- here show one sample each of the various types of filters
-->

            <Chapter>

                  <Title collapsible="no" class=" CPM-Title " toc="true">

                        <tm:te>

                             <tm:tu id="0000001">

                                   <c_date>yyyy_mm_dd_hh_mm</c_date>

                                   <c_usr>USER</c_usr>

                                   <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                   <xtm match="95" id="x00000001"/>

                                   <src>&amp;ProdName; <tm:ix__CharSpan
style="Special" visibility="show" class=" CPM-Text CPM-CharSpan ">Civil
Extension </tm:ix__CharSpan>

                                   </src>

                                   <tgt> </tgt>

                             </tm:tu>

                        </tm:te>

                  </Title>

                  <TopicGroup toc="true"
Id="WS27101fef35e777f95e3974fbf5418b87-7fff">

                        <Title complexity="basic">

                             <tm:te>

                                   <tm:tu id="0000002">

                                         <c_date>yyyy_mm_dd_hh_mm</c_date>

                                         <c_usr>USER</c_usr>

                                         <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                         <xtm match="95" id="x00000001"/>

                                         <src>Topic Group Title</src>

                                         <tgt> </tgt>

                                   </tm:tu>

                             </tm:te>

                        </Title>

                        <BodySummary class=" CPM-Container ISD-BodySummary
">

                             <Blurb class=" CPM-Paragraph  ISD-Blurb">

                                   <tm:te>

                                         <tm:tu id="0000003">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>This is some sample
content in a blurb.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                         <IndexEntry
Id="WSfacf1429558a55de14bb075fd28ccb522-7d27" text="sample:indexEntry"
type="Index" class=" CPM-IndexEntry ">

                                               <tm:ta attr="text">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                                     <c_usr>USER</c_usr>

                                                     <status
repetitions="yes|no" repaired="yes|no" spellcheck="yes|no" grammar="yes|no"
term_check="yes|no" validation_check="yes|no">Complete|Pending</status>

                                                     <xtm match="95"
id="x00000001"/>

 
<src>sample:indexEntry</src>

                                                     <tgt> </tgt>

                                               </tm:ta>

                                               <tm:te>

                                                     <tm:tu id="0000004">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

 
<c_usr>USER</c_usr>

                                                           <status
repetitions="yes|no" repaired="yes|no" spellcheck="yes|no" grammar="yes|no"
term_check="yes|no" validation_check="yes|no">Complete|Pending</status>

                                                           <xtm match="95"
id="x00000001"/>

                                                           <src>sample index
entry</src>

                                                           <tgt> </tgt>

                                                     </tm:tu>

                                               </tm:te>

                                         </IndexEntry>

                                   </tm:te>

                             </Blurb>

                             <Para complexity="basic" class=" CPM-Paragraph
">

                                   <tm:te>

                                         <tm:tu id="0000005">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Each XML element that
contains PCDATA (parsable character data) and matches an analysis rule that
deems is non-translatable is wrapped in a &lt;tm:nx&gt; element.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                         <tm:tu id="0000006">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>This defines 

agments of the XML document which are locked and which do not need to be
translated. </src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Para>

                             <Art type="capture"
Id="WSfacf1429558a55de1870033fd2e4352f2-76f3" class=" CPM-Art "
rollover="no">

                                   <Graphic
file="/Artwork/ISD/Macallan-CUG/English/ai_site_overlayed_a.png"/>

                             </Art>

                             <Note type="Note">

                                   <tm:te>

                                         <tm:tu id="0000007">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Sample Note to be used
for testing</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Note>

                        </BodySummary>

                        <Topic toc="true"
Id="WS27101fef35e777f95e3974fbf5418b87-7ffa" class=" CPM-Topic ">

                             <Title complexity="basic" class=" CPM-Title "
toc="true">

                                   <tm:te>

                                         <tm:tu id="0000008">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Topic Title</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Title>

                             <BodyConcept complexity="basic" class="
CPM-Container ISD-BodyConcept ">

                                   <Blurb
Id="WS27101fef35e777f95e3974fbf5418b87-7ffc" class=" CPM-Paragraph
ISD-Blurb">

                                         <tm:te>

                                         <tm:tu id="0000009">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src> Sample blurb using
<tm:in><metric>metric</metric></tm:in><tm:ix__imperial>imperial</tm:ix__impe
rial> unit system for testing of inline non translatable elements.  </src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             

                                   </Blurb>

                                   <Para complexity="basic" class="
CPM-Paragraph " type="normal">

                                         <tm:te>

                                         <tm:tu id="0000010">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Normal paragraph thats
up for some more testing.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                               <tm:tu id="0000011">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src> We have now covered all
types of translatable atributes.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Para>

                             </BodyConcept>

                        </Topic>    

                        <Topic toc="true"
Id="WS27101fef35e777f95e3974fbf5418b87-7ffb" class=" CPM-Topic ">

                             <Title complexity="basic" class=" CPM-Title "
toc="true">

                                   <tm:te>

                                         <tm:tu id="0000012">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Topic Title</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Title>

                             <BodyConcept complexity="basic" class="
CPM-Container ISD-BodyConcept ">

                                   <Blurb
Id="WS27101fef35e777f95e3974fbf5418b87-7ffc" class=" CPM-Paragraph
ISD-Blurb">

                                         <tm:te>

                                         <tm:tu id="0000013">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src> Sample blurb using
<tm:in><metric>metric</metric></tm:in> imperial unit system for testing of
inline non translatable elements.  </src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             

                                   </Blurb>

                                   <Para complexity="basic" class="
CPM-Paragraph " type="normal">

                                         <tm:te>

                                         <tm:tu id="0000014">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Normal paragraph thats
up for some more testing.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                               <tm:tu id="0000015">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src> We have now covered all
types of translatable atributes.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Para>

                             </BodyConcept>

                        </Topic>    <Topic toc="true"
Id="WS27101fef35e777f95e3974fbf5418b87-7ffc" class=" CPM-Topic ">

                             <Title complexity="basic" class=" CPM-Title "
toc="true">

                                   <tm:te>

                                         <tm:tu id="0000016">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Topic Title</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Title>

                             <BodyConcept complexity="basic" class="
CPM-Container ISD-BodyConcept ">

                                    <Blurb
Id="WS27101fef35e777f95e3974fbf5418b87-7ffc" class=" CPM-Paragraph
ISD-Blurb">

                                         <tm:te>

                                         <tm:tu id="0000017">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src> Sample blurb using
<tm:in><metric>metric</metric></tm:in> imperial unit system for testing of
inline non translatable elements.  </src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             

                                   </Blurb>

                                   <Para complexity="basic" class="
CPM-Paragraph " type="normal">

                                         <tm:te>

                                         <tm:tu id="0000018">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                               <src>Normal paragraph thats
up for some more testing.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                               <tm:tu id="0000019">

 
<c_date>yyyy_mm_dd_hh_mm</c_date>

                                               <c_usr>USER</c_usr>

                                               <status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>

                                               <xtm match="95"
id="x00000001"/>

                                                <src> We have now covered
all types of translatable atributes.</src>

                                               <tgt> </tgt>

                                         </tm:tu>

                                   </tm:te>

                             </Para>

                             </BodyConcept>

                        </Topic>

                  </TopicGroup>

                        <TopicGroup toc="true"
Id="WS27101fef35e777f95e3974fbf5418b87-7fff">

                        <Title complexity="basic">

                        </Title>

                        </TopicGroup>

            

            </Chapter>

      </docmain>

      <xmem>

            <!-- Embedded Translation Memory of TMX format -->

            <tu tuid="x00000001" srclang="en" c_usr="Neeraj Bezalwar"
c_date="20040924144449">

                  <tuv lang="en">

                        <seg>&amp;ProdName;</seg>

                  </tuv>

                  <tuv lang="de_DE">

                        <seg>&amp;ProdName;</seg>

                  </tuv>

            </tu>

      </xmem>

      <xdb>

            <!-- Embedded Term DB of TDB format embeds entire TDB -->

            <termGrp id="1">

                  <term lang="en-US">Source Term</term>

                  <term lang="de_DE">Target Term</term>

                  <desc>Description</desc>

                  <context>Usage Context.</context>

                  <image>img_path_reference</image>

            </termGrp>

      </xdb>

      <scope_rep>

            <!-- The word count and analysis report... this can be for the
entire book - or can be split by topic..  depending on the configuration -->

            

                        <match value="100" type="PCM" seg_count="123"
word_c="4543"/>

                        <match value="100" type="NCM" seg_count="123"
word_c="4543"/>

                        <match value="95-99" type="FUZ" seg_count="123"
word_c="4543"/>

                        <match value="85-95" type="FUZ" seg_count="123"
word_c="4543"/>

                        <match value="75-85" type="FUZ" seg_count="123"
word_c="4543"/>

                        <match value="50-75" type="FUZ" seg_count="123"
word_c="4543"/>

                  

      </scope_rep>

</qxf>

 

--

Shailesh

 


-----Original Message-----
From: Shailesh Shinde [mailto:shailesh@xxxxxxxxxxxx] 
Sent: Tuesday, September 20, 2005 10:54 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: XML to HTML

Hi All,

I have to transformation xml to html.

Sample xml:

<?xml version="1.0"?>
<topic1>
	<Title complexity="basic">
		<Test1>
			<test2 id="0000002">
				<date>yyyy_mm_dd_hh_mm</c_date>
				<usr>USER</c_usr>
				<status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>
				<xtm match="95" id="x00000001"/>
				<src>Topic Group Title</src>
				<tgt> </tgt>
			</test2>
		</test1>
	</Title>
</topic1>
<topic2>
	<Title complexity="basic">
		<Test1>
			<test2 id="0000002">
				<date>yyyy_mm_dd_hh_mm</c_date>
				<usr>USER</c_usr>
				<status repetitions="yes|no"
repaired="yes|no" spellcheck="yes|no" grammar="yes|no" term_check="yes|no"
validation_check="yes|no">Complete|Pending</status>
				<xtm match="95" id="x00000001"/>
				<src>Topic Group Title1</src>
				<tgt> </tgt>
			</test2>
		</test1>
	</Title>
</topic2>

Now, In html output I have to show only src value within h2 tag.
There are many instances of topic tags, from each group i need src to be
diaplayed.

Output:

<h2> Topic Group Title</h2>
<h2> Topic Group Title1</h2>

Thanks,
Shailesh

Current Thread