how to get value which is above of function for each - xslt

I'm stuck to getting data from this xml:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<AAA>Header</AAA>
<BBB>
<CCC>
<DDD>
<EEE>123123</EEE>
<FFF>
<GGG>
<HHH>Body</HHH>
<III>1</III>
</GGG>
<GGG>
<HHH>Body</HHH>
<III>3</III>
</GGG>
</FFF>
</DDD>
</CCC>
<CCC>
<DDD>
<EEE>234234</EEE>
<FFF>
<GGG>
<HHH>Body</HHH>
<III>2</III>
</GGG>
<GGG>
<HHH>Body</HHH>
<III>4</III>
</GGG>
<GGG>
<HHH>Body</HHH>
<III>6</III>
</GGG>
</FFF>
</DDD>
</CCC>
<CCC>
<DDD>
<EEE>345345</EEE>
<FFF>
<GGG>
<HHH>Body</HHH>
<III>7</III>
</GGG>
</FFF>
</DDD>
</CCC>
</BBB>
</document>
Needed result should be:
Header;
Body;1;123123
Body;3;123123
Body;2;234234
Body;4;234234
Body;6;234234
Body;7;345345
My xslt looks:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="text" encoding="Windows-1257" indent="yes"/>
<xsl:template match="/">
<!--Start Header--><xsl:value-of select="document/AAA"/><xsl:text>;</xsl:text>
<!--End Header--><xsl:text>
</xsl:text>
<xsl:for-each select="document/BBB/CCC/DDD/FFF/GGG">
<!--Start Body--><xsl:value-of select="HHH"/><xsl:text>;</xsl:text>
<xsl:value-of select="III"/><xsl:text>;</xsl:text>
<xsl:value-of select="../EEE"/><--This doesn't work-->
<!--End Body--><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
now I have problem to get value from EEE tag. Please help to solve it because I have no idea how to do it.

From your for-each statement the current context that you are working at is document/BBB/CCC/DDD/FFF/GGG.
The full path of the EEE statement is document/BBB/CCC/DDD/EEE.
Therefore you need to come back two levels to reach the EEE node from the GGG node:
<xsl:value-of select="../../EEE"/>

Related

Increase number in text string for each match

I am looking to shorten my XSLT codebase by seeing if XSLT can increase a text number for each match. The text number exists in both the attribute value "label-period0" and the "xls:value-of" value.
The code works, no errors so this is more a question of how to shorten the code and make use of some sort of iteration on a specific character in a string.
I added 2 similar code structures for "period0" and "period1" to better see what exactly are the needed changes in terms of the digit in the text strings.
Source XML file:
<data>
<periods>
<period0><from>2016-01-01</from><to>2016-12-01</to></period0>
<period1><from>2015-01-01</from><to>2015-12-01</to></period1>
<period2><from>2014-01-01</from><to>2014-12-01</to></period2>
<period3><from>2013-01-01</from><to>2013-12-01</to></period3>
</periods>
<balances>
<balance0><instant>2016-12-31</instant></balance0>
<balance1><instant>2015-12-31</instant></balance1>
<balance2><instant>2014-12-31</instant></balance2>
<balance3><instant>2013-12-31</instant></balance3>
</balances>
</data>
XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output method="xml" indent="yes"/>
<!-- Block all data that has no user defined template -->
<xsl:mode on-no-match="shallow-skip"/>
<xsl:template match="data">
<results>
<periods>
<periods label="period0">
<xsl:value-of
select =
"concat(periods/period0/from, '--', periods/period0/to)"
/>
</periods>
<periods label="period1">
<xsl:value-of
select =
"concat(periods/period1/from, '--', periods/period1/to)"
/>
</periods>
<!-- Etc for period [2 and 3]-->
</periods>
<balances>
<balance label="balance0">
<xsl:value-of select ="balances/balance0/instant"/>
</balance>
<!-- Etc for balance [1,2 and 3] -->
</balances>
</results>
</xsl:template>
</xsl:transform>
Result:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<periods>
<periods label="period0">2016-01-01--2016-12-01</periods>
<periods label="period1">2015-01-01--2015-12-01</periods>
</periods>
<balances>
<balance label="balance0">2016-12-31</balance>
</balances>
</results>
Wanted result:
(with an XSL that steps the digit in the text string, or any other logics in XSL that could cater for manipulating the digit in text string)
<?xml version="1.0" encoding="UTF-8"?>
<results>
<periods>
<periods label="period0">2016-01-01--2016-12-01</periods>
<periods label="period1">2015-01-01--2015-12-01</periods>
<periods label="period2">2014-01-01--2015-12-01</periods>
<periods label="period3">2013-01-01--2015-12-01</periods>
</periods>
<balances>
<balance label="balance0">2016-12-31</balance>
<balance label="balance1">2015-12-31</balance>
<balance label="balance2">2014-12-31</balance>
<balance label="balance3">2013-12-31</balance>
</balances>
</results>
Couldn't you do simply something like:
<xsl:template match="/data">
<results>
<periods>
<xsl:for-each select="periods/*">
<periods label="{name()}">
<xsl:value-of select="from"/>
<xsl:text>--</xsl:text>
<xsl:value-of select="to"/>
</periods>
</xsl:for-each>
</periods>
<balances>
<xsl:for-each select="balances/*">
<balance label="{name()}">
<xsl:value-of select="instant"/>
</balance>
</xsl:for-each>
</balances>
</results>
</xsl:template>
If you want to do your own numbering, you can change:
<periods label="{name()}">
to:
<periods label="period{position() - 1}">

Compare data of 2 xmls in xslt

I am new to XSL. Hence please help me with the below.
I have 2 xmls. I have to do the following in XSL transformation.
if Employee/EmployeeInfo/FirstName = EmployeeSegment/EmployeeSummary/GivenName and Employee/EmployeeInfo/LastName = EmployeeSegment/EmployeeSummary/Surname
employeeId = EmployeeSegment/EmployeeSummary/EmpId
XML1
<Employee>
<EmployeeInfo>
<FirstName>ABC</FirstName>
<LastName>DEF</LastName>
</EmployeeInfo>
</Employee>
XML2
<EmployeeSegment>
<EmployeeSummary>
<EmpId>1234</EmpId>
<GivenName>ABC</GivenName>
<Surname>DEF</Surname>
</EmployeeSummary>
</EmployeeSegment>
I have tried the following. It is not working.
<xsl:param name="cjEmployeeSegment" select="document('CJ_Response.xml')"/>
<xsl:for-each select="/ns3:Employee/ns3:EmployeeInfo">
<xsl:variable name="empFirstName">
<xsl:value-of select="ns1:FirstName"/>
</xsl:variable>
<xsl:variable name="empLastName">
<xsl:value-of select="ns1:LastName"/>
</xsl:variable>
<xsl:for-each select="$cjEmployeeSegment/v32:EmployeeSegment/v31:EmployeeSummary">
<xsl:if test="$empFirstName=v31:GivenName and $empLastName=v31:Surname">
<ns12:EmployeeIdentifier>
<ns12:EmployeeID>
<xsl:value-of select="v31:EmpId"/>
</ns12:EmployeeID>
</ns12:EmployeeIdentifier>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
Assuming you are processing the following input:
XML
<Employee>
<EmployeeInfo>
<FirstName>ABC</FirstName>
<LastName>DEF</LastName>
</EmployeeInfo>
</Employee>
and there is another XML document named CJ_Response.xml:
<EmployeeSegment>
<EmployeeSummary>
<EmpId>1234</EmpId>
<GivenName>ABC</GivenName>
<Surname>DEF</Surname>
</EmployeeSummary>
</EmployeeSegment>
you can use the following stylesheet:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="cj_Response" select="document('CJ_Response.xml')"/>
<xsl:template match="/Employee">
<root>
<xsl:for-each select="EmployeeInfo">
<xsl:variable name="lookup" select="$cj_Response/EmployeeSegment/EmployeeSummary[GivenName = current()/FirstName and Surname = current()/LastName]" />
<xsl:if test="$lookup">
<EmployeeIdentifier>
<EmployeeID>
<xsl:value-of select="$lookup/EmpId"/>
</EmployeeID>
</EmployeeIdentifier>
</xsl:if>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
to return:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<EmployeeIdentifier>
<EmployeeID>1234</EmployeeID>
</EmployeeIdentifier>
</root>
Of course, this will fail miserably if there are two or more employees with the same name.

Show distinct records, remove duplicates from xml document using xslt

I have an xml document from that I have to remove duplicate <itemGrp> based on
<rateclass> value.
If there are multiple <itemGrp> with the same <rateclass> exclude all except 1 <itemGrp>
Including xml and xslt, The results can be seen at http://www.freeformatter.com/xsl-transformer.html
by pasting the xml and xslt
XSLT:
<xsl:stylesheet version="2.0"
xmlns:a="http://xml.amadeus.com/FQDRES_12_1_1A"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:vbs="urn:schemas-sqlxml-org:vbs">
<!-- Main Template -->
<xsl:template match="/Responses">
<xsl:element name="Fares">
<xsl:for-each select="./RequestResponse/Fare_DisplayFaresForCityPairReply">
<xsl:for-each select="./a:flightDetails">
<!-- inside each flight details, we want to get all of the item groups-->
<xsl:for-each select="./a:itemGrp">
<!-- if rateclass repeating then skip this record other wise add this record to output file-->
<xsl:element name="Calss">
<xsl:value-of select="./a:fareQualifItem/a:additionalFareDetails/a:rateClass"/>
</xsl:element>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
XML:
<Responses>
<RequestResponse>
<Fare_DisplayFaresForCityPairReply xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<flightDetails xmlns="http://xml.amadeus.com/FQDRES_12_1_1A">
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>XK2DCA</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>XK2DCAB</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>XK2DCA</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
</flightDetails>
<flightDetails xmlns="http://xml.amadeus.com/FQDRES_12_1_1A">
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>AAXK2DCA</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>BXK2DCAB</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
<itemGrp>
<fareQualifItem>
<additionalFareDetails>
<rateClass>AAXK2DCA</rateClass>
</additionalFareDetails>
<discountDetails>
<fareQualifier>725</fareQualifier>
</discountDetails>
</fareQualifItem>
</itemGrp>
</flightDetails>
</Fare_DisplayFaresForCityPairReply>
</RequestResponse>
</Responses>
The response is:
<?xml version="1.0" encoding="UTF-8"?>
<Fares>
<Calss>XK2DCA</Calss>
<Calss>XK2DCAB</Calss>
<Calss>XK2DCA</Calss>
<Calss>AAXK2DCA</Calss>
<Calss>BXK2DCAB</Calss>
<Calss>AAXK2DCA</Calss>
</Fares>
What I want is:
<?xml version="1.0" encoding="UTF-8"?>
<Fares>
<Calss>XK2DCA</Calss>
<Calss>XK2DCAB</Calss>
<Calss>AAXK2DCA</Calss>
<Calss>BXK2DCAB</Calss>
</Fares>
Thanks for the answer Michael. could've been solved:
XSLT 1.0
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://xml.amadeus.com/FQDRES_12_1_1A" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:vbs="urn:schemas-sqlxml-org:vbs" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<!-- Main Template -->
<xsl:key name="rateClass" match="/Responses/RequestResponse/Fare_DisplayFaresForCityPairReply/a:flightDetails/a:itemGrp/a:fareQualifItem/a:additionalFareDetails/a:rateClass/text()" use="." />
<xsl:template match="/Responses">
<xsl:element name="Fares">
<xsl:for-each select="./RequestResponse/Fare_DisplayFaresForCityPairReply">
<xsl:for-each select="./a:flightDetails">
<!-- inside each flight details, we want to get all of the item groups-->
<xsl:for-each select="./a:itemGrp">
<!-- if rateclass repeating then skip this record other wise add this record to output file-->
<xsl:variable name="ItemGroup_Items" select="." />
<!--<xsl:variable name="rateClass_1" select="./a:fareQualifItem/a:additionalFareDetails/a:rateClass"/>
<xsl:if test="vbs:CheckExists($rateClass_1) = 'FALSE'">-->
<xsl:for-each select="./a:fareQualifItem/a:additionalFareDetails/a:rateClass/text()[generate-id()= generate-id(key('rateClass',.)[1])]">
<xsl:element name="Calss">
<xsl:value-of select="." />
</xsl:element>
<xsl:element name="Value_from_itemGrp">
<xsl:value-of select="($ItemGroup_Items/a:fareQualifItem/a:additionalFareDetails/a:rateClass)"/>
</xsl:element>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Given your latest XML input, the expected output can be achieved quite simply by:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://xml.amadeus.com/FQDRES_12_1_1A"
exclude-result-prefixes="a">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template match="/Responses">
<Fares>
<xsl:for-each select="distinct-values(RequestResponse/Fare_DisplayFaresForCityPairReply/a:flightDetails/a:itemGrp/a:fareQualifItem/a:additionalFareDetails/a:rateClass)">
<Calss>
<xsl:value-of select="."/>
</Calss>
</xsl:for-each>
</Fares>
</xsl:template>
</xsl:stylesheet>

XSL cross reference

I am stuck with a XSLT 1.0 problem. I tried to find info on StackOverflow but I couldn't apply the examples.
Here is the structure of my XML:
<XML>
<PR>
<AS>
<ID_AS>AS-001</ID_AS>
<FIRST>
<ID_CATALOG>Id-001</ID_CATALOG>
<STATUS>NOK</STATUS>
</FIRST>
<SECOND>
<ID_CATALOG>Id-002</ID_CATALOG>
<STATUS>OK</STATUS>
</SECOND>
</AS>
<AS>
<ID_AS>AS-002</ID_AS>
<FIRST>
<ID_CATALOG>Id-003</ID_CATALOG>
<STATUS>OK</STATUS>
</FIRST>
<SECOND>
<ID_CATALOG>Id-004</ID_CATALOG>
<STATUS>OK</STATUS>
</SECOND>
</AS>
</PR>
<METADATA>
<ID_CATALOG>Id-001</ID_CATALOG>
<ANGLES>32.25</ANGLES>
</METADATA>
<METADATA>
<ID_CATALOG>Id-002</ID_CATALOG>
<ANGLES>18.75</ANGLES>
</METADATA>
<METADATA>
<ID_CATALOG>Id-003</ID_CATALOG>
<ANGLES>5.23</ANGLES>
</METADATA>
<METADATA>
<ID_CATALOG>Id-004</ID_CATALOG>
<ANGLES>12.41</ANGLES>
</METADATA>
</XML>
I want to display for each AS, the FIRST/ID_CATALOG, FIRST/STATUS and ANGLES corresponding to the ID_CATALOG, then SECOND/etc.
The output would be similar to:
AS-001
Id-001 NOK 32.25
Id-002 OK 18.75
AS-002
Id-003 OK 5.23
Id-004 OK 12.41
I tried the following XSL but I only get the ANGLES for the first item
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns="http://earth.google.com/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:hma="http://earth.esa.int/hma" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
<!--==================MAIN==================-->
<xsl:template match="/">
<html>
<body>
AS List:
<br/><br/>
<xsl:call-template name="ASandCo"/>
</body>
</html>
</xsl:template>
<!--==================TEMPLATES==================-->
<xsl:template name="ASandCo">
<AS>
<xsl:for-each select="XML/PR/AS">
<xsl:value-of select="ID_AS"/>
<br/>
<xsl:value-of select="FIRST/ID_CATALOG"/> - <xsl:value-of select="FIRST/STATUS"/> -
<xsl:if test="contains(/XML/METADATA/ID_CATALOG, FIRST/ID_CATALOG)">
<xsl:value-of select="/XML/METADATA/ANGLES"/>
</xsl:if>
<br/>
<xsl:value-of select="SECOND/ID_CATALOG"/> - <xsl:value-of select="SECOND/STATUS"/> -
<xsl:if test="contains(/XML/METADATA/ID_CATALOG, SECOND/ID_CATALOG)">
<xsl:value-of select="/XML/METADATA/ANGLES"/>
</xsl:if>
<br/><br/>
</xsl:for-each>
</AS>
</xsl:template>
</xsl:stylesheet>
This XSLT will be applied to very large XML files, so I am trying to find the most efficient way.
Thank you very much in advance!
It seems like you want to look up some metadata metadata based on the ID_CATALOG value.
An efficient way to do this is by using a key. You can define a key on the top level:
<xsl:key name="metadata-by-id_catalog" match="METADATA" use="ID_CATALOG"/>
And then you can look up the ANGLES value using the key for a given ID_CATALOG value like this:
<xsl:value-of select="key('metadata-by-id_catalog', FIRST/ID_CATALOG)/ANGLES"/>
and this:
<xsl:value-of select="key('metadata-by-id_catalog', SECOND/ID_CATALOG)/ANGLES"/>

Unwanted element data (without elements) appears in xslt

I am trying to apply a transformation to generate an rdf document. My source xml contains an element that I want to ignore, but the output (generated via SAP's transformation test tool) includes the (concatenated!) texts of the elements from SYSINFO.
I have tried several variations (such as xsl:apply-templates select="asx:abap/asx:/values/CT" )
but then I get no output at all. Hmm. Have spent several hours trying different things and researching, but have gotten nowhere. Any help really appreciated. John
Here is my sample xml (fragment)
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml"version="1.0">
<asx:values>
<SYSINFO>
<SERVER_NAME>sapserver06</SERVER_NAME>
<SYSTEM_ID>ECC</SYSTEM_ID>
<SAP_RELEASE>701</SAP_RELEASE>
<SYS_NR>00</SYS_NR>
<CLIENT>800</CLIENT>
<EXE_USER>XXX</EXE_USER>
<LOGON_LANGUAGE>E</LOGON_LANGUAGE>
<DATE>2013-04-09</DATE>
<TIME>12:06:58</TIME>
<TIMEZONE>CST</TIMEZONE>
<OPERATING_SYSTEM>Windows NT</OPERATING_SYSTEM>
<LICENSE_NUMBER>YYY</LICENSE_NUMBER>
<SAP_CUSTOMER>ZZZ</SAP_CUSTOMER>
<CLIENT_CATEGORY>C</CLIENT_CATEGORY>
<LANGUAGES_INSTALLED>JED</LANGUAGES_INSTALLED>
</SYSINFO>
<CT>
<item>
<ID>1</ID>
<TABNAME>T000</TABNAME>
<FIELDNAME>ADRNR</FIELDNAME>
<KEYFLAG/>
<ROLLNAME>CHAR10</ROLLNAME>
</item>
.....
</CT>
</asx:values>
</asx:abap>
Here is the transformation
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sap_coda="http://www.sapmantics.com/sap_coda#" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<rdf:RDF>
<xsl:apply-templates/>
</rdf:RDF>
</xsl:template>
<xsl:template>
<xsl:for-each select="//item">
<rdf:Description>
<xsl:attribute name="rdf:about">
<xsl:value-of select="TABNAME"/>
</xsl:attribute>
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#ctable"/>
<sap_coda:t2f>
<rdf:Description>
<xsl:attribute name="rdf:about">
<xsl:value-of select="FIELDNAME"/>
</xsl:attribute>
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#cfield"/>
<xsl:if test="KEYFLAG=X">
<sap_coda:keyflag>X</sap_coda:keyflag>
</xsl:if>
</rdf:Description>
</sap_coda:t2f>
</rdf:Description>
</xsl:for-each>
</xsl:template>
</xsl:transform>
And finally, here is the output:
<?xml version="1.0" encoding="utf-16"?>
sapserver06ECC70100800XXXE2013-04-0917:21:50CSTWindowsNTYYYZZZCJED
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sap_coda="http://www.sapmantics.com/sap_coda#">
<rdf:Description rdf:about="T000">
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#ctable"/>....
The concatenation of your <SYSINFO/> text nodes can be explained by the default handing for element nodes:
http://www.w3.org/TR/xslt#built-in-rule
I don't know which XSLT processor you are using, but I am surprised that your //item handler wasn't flagged for lacking a #match attribute. You can update it with the following, and it will handle each <item/> element in document order:
<xsl:template match="item">
<rdf:Description>
To keep your SYSINFO content from being included in your RDF (if that is your intent), update your root template with the following:
<rdf:RDF>
<xsl:apply-templates select="//item"/>
</rdf:RDF>
-----------EDIT--------------------------
With this input
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<SYSINFO>
<SERVER_NAME>sapserver06</SERVER_NAME>
<SYSTEM_ID>ECC</SYSTEM_ID>
<SAP_RELEASE>701</SAP_RELEASE>
<SYS_NR>00</SYS_NR>
<CLIENT>800</CLIENT>
<EXE_USER>XXX</EXE_USER>
<LOGON_LANGUAGE>E</LOGON_LANGUAGE>
<DATE>2013-04-09</DATE>
<TIME>12:06:58</TIME>
<TIMEZONE>CST</TIMEZONE>
<OPERATING_SYSTEM>Windows NT</OPERATING_SYSTEM>
<LICENSE_NUMBER>YYY</LICENSE_NUMBER>
<SAP_CUSTOMER>ZZZ</SAP_CUSTOMER>
<CLIENT_CATEGORY>C</CLIENT_CATEGORY>
<LANGUAGES_INSTALLED>JED</LANGUAGES_INSTALLED>
</SYSINFO>
<CT>
<item>
<ID>1</ID>
<TABNAME>T000</TABNAME>
<FIELDNAME>ADRNR</FIELDNAME>
<KEYFLAG/>
<ROLLNAME>CHAR10</ROLLNAME>
</item>
</CT>
</asx:values>
</asx:abap>
and this stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sap_coda="http://www.sapmantics.com/sap_coda#"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<rdf:RDF>
<xsl:apply-templates select="//item"/>
</rdf:RDF>
</xsl:template>
<xsl:template match="item[parent::CT]">
<rdf:Description>
<xsl:attribute name="rdf:about">
<xsl:value-of select="TABNAME"/>
</xsl:attribute>
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#ctable"/>
<sap_coda:t2f>
<rdf:Description>
<xsl:attribute name="rdf:about">
<xsl:value-of select="FIELDNAME"/>
</xsl:attribute>
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#cfield"/>
<xsl:if test="KEYFLAG=X">
<sap_coda:keyflag>X</sap_coda:keyflag>
</xsl:if>
</rdf:Description>
</sap_coda:t2f>
</rdf:Description>
</xsl:template>
<xsl:template match="item[parent::FOO]"/>
<xsl:template match="item"/>
</xsl:transform>
I get this output from Saxon-EE 9.4.0.3:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:sap="http://www.sap.com/sapxsl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sap_coda="http://www.sapmantics.com/sap_coda#">
<rdf:Description rdf:about="T000">
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#ctable"/>
<sap_coda:t2f>
<rdf:Description rdf:about="ADRNR">
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#cfield"/>
</rdf:Description>
</sap_coda:t2f>
</rdf:Description>
</rdf:RDF>
and this output from xstlproc:
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sap="http://www.sap.com/sapxsl" xmlns:sap_coda="http://www.sapmantics.com/sap_coda#">
<rdf:Description rdf:about="T000">
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#ctable"/>
<sap_coda:t2f>
<rdf:Description rdf:about="ADRNR">
<rdf:type rdf:resource="http://www.sapmantics.com/sap_coda#cfield"/>
</rdf:Description>
</sap_coda:t2f>
</rdf:Description>
</rdf:RDF>