[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: no attributes outputed when chaining transformatio
Subject: Re: no attributes outputed when chaining transformations
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Thu, 16 Dec 2004 21:11:53 +0100
|
Yep (again), i'm pretty sure it is a namespace problem. Look up my previous post in this thread to
find some solutions..
Cheers
Neville Thomas wrote:
Michael Kay wrote:
The problem could easily be some slip-up in the template matching rules,
e.g. a phase-1 template rule being invoked when you intended a phase-2
rule
to fire.
Here are my samples, do you see anything that might cause this slip-up?
public class MyXMLFilters
{
public static void main(String[] args)
throws TransformerException, TransformerConfigurationException,
SAXException, IOException {
TransformerFactory tFactory = TransformerFactory.newInstance();
if (tFactory.getFeature(SAXSource.FEATURE) &&
tFactory.getFeature(SAXResult.FEATURE))
{
SAXTransformerFactory saxTFactory = ((SAXTransformerFactory)
tFactory);
XMLFilter xmlFilter1 = saxTFactory.newXMLFilter(new
StreamSource("0_map_1.xslt"));
XMLFilter xmlFilter2 = saxTFactory.newXMLFilter(new
StreamSource("1_map_2.xslt"));
XMLReader reader = XMLReaderFactory.createXMLReader();
xmlFilter1.setParent(reader);
xmlFilter2.setParent(xmlFilter1);
Serializer serializer = SerializerFactory.getSerializer
(OutputPropertiesFactory.getDefaultMethodProperties("xml"));
serializer.setOutputStream(System.out);
xmlFilter2.setContentHandler(serializer.asContentHandler());
xmlFilter2.parse(new InputSource("SouthPole.xml"));
}
}
}
****SouthPole.xml*****
<?xml version="1.0" encoding="UTF-8"?>
<testPlan baseDir="${TEST_BASE_DIR}"
fedFile="${IBUILD_HOME}/FOM/${FED_FILE}" federationName="SIAP"
hlaControlDir="${HLA_CONTROL}" ridFile="${RID_FILE}"
rtiBuildType="${RTI_BUILD_TYPE}" rtiExecArgs="${RTI_ARGS}"
rtiHome="${RTI_HOME}" testPlanName="CRSAcceptanceSouthPole"
xmlns="http://www.virtc.com"
xmlns:x0="http://www.w3.org/2001/XMLSchema">
</testPlan>
*****Stylesheet 0_map_1.xslt***********
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:n12="http://www.virtc.com" xmlns:att="http://www.virtc.com/att"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.virtc.com/jdep/att" exclude-result-prefixes="xs n12 att">
<xsl:output method="xml" encoding="UTF-8"/>
<!--xsl:param name="tpVersion" select="'1'"/-->
<xsl:template match="/n12:testPlan">
<testPlan>
<xsl:attribute
name="xsi:schemaLocation">http://www.virtc.com/jdep/att
D:/jdep/ATTCON~1/ATT_1_0_8/TestPlan.xsd</xsl:attribute>
<xsl:for-each select="@testPlanName">
<xsl:attribute name="testPlanName">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="@baseDir">
<xsl:attribute name="baseDir">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
</testPlan>
</xsl:template>
</xsl:stylesheet>
*****Stylesheet 1_map_2.xslt***********
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:n12="http://www.virtc.com/jdep/att"
xmlns="http://www.virtc.com/jdep/att" exclude-result-prefixes="xs n12 ">
<xsl:output method="xml" encoding="UTF-8"/>
<!--xsl:param name="tpVersion" select="'2'"/-->
<xsl:template match="/n12:testPlan">
<testPlan>
<xsl:attribute
name="xsi:schemaLocation">http://www.virtc.com/jdep/att
C:/cvsroot/iBuild/jdep/ATT/dist/TestPlan.xsd</xsl:attribute>
<xsl:for-each select="@testPlanName">
<xsl:attribute name="testPlanName">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="@baseDir">
<xsl:attribute name="baseDir">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="@federationName">
<xsl:attribute name="federationName">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
</testPlan>
</xsl:template>
</xsl:stylesheet>
--
Geert.Josten@xxxxxxxxxxx
IT-consultant at Daidalos BV, Zoetermeer (NL)
http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464
GPG: 1024D/12DEBB50
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|