473,804 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XLST - Help needed to write the XSL (2)

8 New Member
HI,

This time , I need to write the XSL to transform the following document :

<?xml version="1.0"?>
<nplbiblio rundate="200801 10">
<document status="U" creadate="19990 410">
<xp>00000002887 6</xp>
<doctype>ABSTRA CT</doctype>
<prdate>1988013 1</prdate>
<ord>19880131 </ord>
<titles>
<title> CREEP BEHAVIOR OF GLASS FIBER-REINFORCED HARDBOARD.</title>
</titles>
<author>SMULS KI S. J., IFJU G.</author>
<supplier>MIGRA TION</supplier>
<attribs>
<attrib name="nr_hostdo c">07</attrib>
<attrib name="pg_abs">9 40</attrib>
<attrib name="vol_hostd oc">58</attrib>
</attribs>
<publication>
<pubtitle>ABSTR ACT BULLETIN OF THE INSTITUTE OF PAPER CHEMISTRY.</pubtitle>
<pubname>THE INSTITUTE OF PAPER CHEMISTRY-LIBRARY. APPLETON.</pubname>
<pubaddr>US</pubaddr>
<pubattr>
<attrib name="magno_hos tdoc">0005500</attrib>
<attrib name="vnum_host doc">1004</attrib>
</pubattr>
</publication>
</document>
</nplbiblio>



into :

<?xml version="1.0" ?>
<nplbiblio rundate="200801 10">
<document status="U" creadate="19990 410">
<xp>00000002887 6</xp>
<doctype>ABSTRA CT</doctype>
<prdate>1988013 1</prdate>
<ord>19880131 </ord>

<title language=" ">CREEP BEHAVIOR OF GLASS FIBER-REINFORCED HARDBOARD.</title>

<author>SMULS KI S. J., IFJU G.</author>
<supplier>MIGRA TION</supplier>

<issue>07</issue>
<first_page> 940.</first_page>
<volume>58</volume>

<pubtitle>ABSTR ACT BULLETIN OF THE INSTITUTE OF PAPER CHEMISTRY.</pubtitle>

<pubname>THE INSTITUTE OF PAPER CHEMISTRY-LIBRARY. APPLETON.</pubname>

<pubaddr>US</pubaddr>

</document>
</nplbiblio>


The transformations required is to :
- Extract only some specific tags and their data
- Make some sub level tags as main level tags
- Change the name of some tags

Can you help ?

I have written this xlst :


<?xml version="1.0"?>
<xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" xmlns:npl="http ://www.epo.org/npl" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" doctype-system="npl-entities.dtd"/>
<xsl:template match="/">
<nplbiblio>
<xsl:attribut e name="xsi:noNam espaceSchemaLoc ation">npldoc v2.0.xsd</xsl:attribute>
<xsl:attribut e name="rundate"> 20080123</xsl:attribute>
<xsl:for-each select="nplbibl io/document">
<document status="n">
<xsl:attribut e name="creadate" >20080123</xsl:attribute>

<xsl:copy-of select="xp"/>
<xsl:copy-of select="doctype "/>
<xsl:copy-of select="prdate"/>
<xsl:copy-of select="xp"/>
<xsl:copy-of select="author"/>
<xsl:copy-of select="supplie r"/>

<title>
<xsl:value-of select="title"/>
</title>

<first_page">
<xsl:value-of select="pg_from _hostdoc"/>
</first_page">
<volume>
<xsl:value-of select="vol_fro m_hostdoc"/>
</volume>
<issue>
<xsl:value-of select="nr_from _hostdoc"/>
</issue>
<issn>
<xsl:value-of select="issn"/>
</issn>

<isbn>
<xsl:value-of select="isbn"/>
</isbn>

</document>
</xsl:for-each>
</nplbiblio>
</xsl:template>
</xsl:stylesheet>


But I keep getting errors....
Jun 27 '08 #1
1 1709
sarah12
8 New Member
My last xslt :


<?xml version="1.0"?>
<xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" xmlns:npl="http ://www.epo.org/npl" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" doctype-system="npl-entities.dtd"/>
<xsl:template match="/">
<nplbiblio>
<xsl:attribut e name="xsi:noNam espaceSchemaLoc ation">npldoc v2.0.xsd</xsl:attribute>
<xsl:attribut e name="rundate"> 20080123</xsl:attribute>
<xsl:for-each select="nplbibl io/document">
<document status="n">
<xsl:attribut e name="creadate" >20080123</xsl:attribute>

<xsl:copy-of select="xp"/>
<xsl:copy-of select="doctype "/>
<xsl:copy-of select="prdate"/>
<xsl:copy-of select="xp"/>
<xsl:copy-of select="author"/>
<xsl:copy-of select="supplie r"/>

<title>
<xsl:value-of select="documen t/titles/title"/>
</title>

<isbn>
<xsl:value-of select="documen t/publication/irn/isbn"/>
</isbn>

<issn>
<xsl:value-of select="documen t/publication/irn/issn"/>
</issn>

<first_page>
<xsl:value-of select="documen t/attribs/attrib name=pg_from_ho stdoc"/>
</first_page>

<volume>
<xsl:value-of select="documen t/attribs/attrib name=vol_from_h ostdoc"/>
</volume>

<issue>
<xsl:value-of select="documen t/attribs/attrib name=nr_from_ho stdoc"/>
</issue>

</document>
</xsl:for-each>
</nplbiblio>
</xsl:template>
</xsl:stylesheet>
Jun 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2134
by: Pascal Sartoretti | last post by:
Hello, I am looking for a formal definition of XSLT. Either a DTD or an XML Schema, whatever. Is there such a thing ? There is for instance one for XML Schema itself at http://www.w3.org/2001/XMLSchema.dtd . My problem is that I have a big set of XSLT files which may contain errors: for instance, use of XLST features that were only in the draft XSLT norm, but which Microsoft IE still supports. A DTD or XML Schema would greatly help me...
1
3067
by: Vital Lobachevsky | last post by:
Hi! I'm absolutely newbie with XSLT. Please, help me with this example. I have simple XML document like this: <skip /> <aaa> <link url="url1" /> <link url="url2" />
3
2011
by: Greg Jones | last post by:
Hello, This may be a simple question but difficult to search on since the keywords are so generic. Is there a way, in XSLT, to copy an embedded DTD from the source XML to the target XML? Using 'match="processing-instruction()"' doesn't work. I have been forced to simply output the DTD in the XSLT with <xslt:text>.
3
2630
by: Hai Nguyen | last post by:
I would like to know after transforming my datatables which store in dataset into XML form. Now I want to save it into a file and also create a XLST file to read it. How can I do that? Would you give me any advice or link to further my understandings. Thanks for any clues
3
1475
by: Hai Nguyen | last post by:
Sorry I don't have code yet. I'm asking for solutions which can help me solve the problem. This is the first time I have to cope this situation, hence I'm clueless how to start. I would like to ask for some ideas then I can start from scratch. Let's say: I have a dataset which has a table Customers (which retrieves from an Access Database) 1/ I convert it into XML format, it should look like this <Customer> <Name>...</Name>
1
1208
by: Adrian | last post by:
Hi No sure if xlst is the correct choice! or if it is how I would use it from within a windows VB application! I had XML data help in an xmlelements object and I want to format the data and display it within my VB dotnet windows application. the data is not held in a file it is received back from a web service, and I want to avoid writing it as a file and reading it back! What's the best way of doing this? any links to examples?
1
1193
by: ad | last post by:
Hi, How can I use xlst to display a xml file in asp.net?
5
1494
by: MD | last post by:
my database return the search result in the xml. I have about 100 fields with 10 records if i use the dom to parse in the browser with javascript takes about 30 seconds to generate the table with search result If i use the xlst to transform this xml document to table any faster? if not faster way to display this complicated data with 100 fields?
1
1972
by: dave_kajinsky | last post by:
Hello all, I would like to do something with xlst, perhaps I can get help from this group? Here it goes: I've got 2 files: an ascii file and a file that identifies tokens in the ascii file. For example the ascii file could be:
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.