XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2016)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Wai MokSubject: transfer xml into xslt
Author: Wai Mok
Date: 12 May 2006 04:53 PM
Originally Posted: 12 May 2006 04:39 PM
I have an input xml with different tags. I would like to select the tag I wanted and parse to the text output file.

Here is the input xml files
<FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4" r="20030618" s="20040109" v="4.4" xr="FIA" xv="1">
<Batch>
<SecListUpd BizDt="2006-04-24" RptID="8705349" UpdActn="M">
<Pty ID="XASE" R="22">
<Sub ID="2001-06-20" Typ="27"></Sub>
</Pty>
</SecListUpd>

<SecDefUpd BizDt="2006-04-24" Ccy="USD" RptID="8026163" UpdActn="M">
<Pty ID="XASE" R="22">
<Sub ID="2001-06-20" Typ="27"></Sub>
</Pty>
</SecDefUpd>

<SecDef BizDt="2006-04-24" Ccy="USD" RptID="23743">
<Pty ID="XASE" R="22">
<Sub ID="2001-06-20" Typ="27"></Sub>
</Pty>
</SecDef>

<SecList BizDt="2006-04-24" RptID="8469055">
<Instrmt CFI="OCECPN" ID="EQ" MMY="200605" MatDt="2006-05-12" Src="J" StrkPx="1480" StrkQt="1480.00" Sym="CBP">
<Evnt Dt="2006-02-11" EventTyp="5"></Evnt>
</Instrmt>
</SecList>

</Batch>
</FIXML>

If I only want to parse the tag = SecDefUpd or SecDef, I wonder what I need to change with my xslt.

The following is my xslt:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.fixprotocol.org/FIXML-4-4">

<xsl:template match="/">
<xsl:apply-templates select="a:FIXML/a:Batch/child::*"/>
</xsl:template>

<xsl:template match="*">
<xsl:for-each select="descendant-or-self::*">
<xsl:for-each select="attribute::*">
<xsl:value-of select="."/>
<xsl:text>|</xsl:text>
</xsl:for-each>
</xsl:for-each><xsl:text>
</xsl:text> </xsl:template>
</xsl:stylesheet>

Thanks
Wai

Postnext
Minollo I.Subject: transfer xml into xslt
Author: Minollo I.
Date: 12 May 2006 05:31 PM
I guess you can just change...

<xsl:apply-templates select="a:FIXML/a:Batch/child::*"/>

...into...

<xsl:apply-templates select="a:FIXML/a:Batch/*[local-name()='SecDefUpd' or local-name()='SecDef']"/>

?

Posttop
Wai MokSubject: transfer xml into xslt
Author: Wai Mok
Date: 15 May 2006 09:53 AM
It works.
Thanks a lot
Wai

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.