I am new to XSLT. I am trying to transform one XML document to another. My first step is to try an do a really simple example. I want to see the results to my simple example in a browser, but neither IE7 or Firefox is not returning the results I expect. My XML is: [code] <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> </catalog> [/code] I simply want to produce a simple output of: [code] <root> <singer>Bob Dylan</singer> …

Member Avatar
Member Avatar
+0 forum 4

I wish to filter records during an xsl transformation. I know basic filtering is quite simple, however, I wish it to be conditional based on data from the original source xml data. My source data will have several updates for the same record in it. Each update will be identified with an event sequence number. I only want the last event sequence in my transformed data. Here is a sample of my source data: [code] <?xml version="1.0" encoding="UTF-8"?> <Msg xmlns="http://schemas.namespace.org/myschema/myschame.xsd" schemalocation="http://schemas.namespace.org/myschema/myschema.xsd ../myschema.xsd" schemaversion="5"> <NumberofRecordsEnclosed>7</NumberofRecordsEnclosed> <Record> <EventSequenceNumber>3</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>4</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> …

Member Avatar
Member Avatar
+0 forum 1

I wish to perform a sort of an XML document, and have the output be in the same structure as the existing document. The reason for doing this, is I need the resulting document to be transformed into a new document. My source XML is: [code] <?xml version="1.0" encoding="UTF-8"?> <Msg xmlns="http://schemas.namespace.org/myschema/myschame.xsd" schemalocation="http://schemas.namespace.org/myschema/myschema.xsd ../myschema.xsd" schemaversion="5"> <NumberofRecordsEnclosed>7</NumberofRecordsEnclosed> <Record> <EventSequenceNumber>3</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>4</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>5</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>6</EventSequenceNumber> <ReplaceRecord> <Id> <Number>1234</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>1</EventSequenceNumber> <ReplaceRecord> <Id> <Number>5678</Number> </Id> </ReplaceRecord> </Record> <Record> <EventSequenceNumber>2</EventSequenceNumber> <ReplaceRecord> <Id> <Number>5678</Number> …

Member Avatar
Member Avatar
+0 forum 1

I really need help in copying the root node. I have been spending far too much time on this, and I can't beleive that it should be that difficult. I can't use 'copy-of', as that will copy all the children as well. I need to copy the root node, and it's attributes. This is what I currently have: [code] <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pre="http://schemas.namespace.org/myschema/myschame.xsd"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:element name="{name()}"> <xsl:apply-templates select="pre:Msg" /> </xsl:element> </xsl:template> <xsl:template match="pre:Msg"> <xsl:for-each select="pre:Record"> <xsl:sort select="pre:ReplaceRecord/pre:Id/pre:Number" /> <xsl:sort select="pre:EventSequenceNumber" data-type="number"/> <xsl:copy-of select="." /> </xsl:for-each> </xsl:template> </xsl:stylesheet> [/code] The above xsl …

Member Avatar
Member Avatar
+0 forum 1

The End.