Click here to Skip to main content
15,895,084 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: XSLT Pin
PIEBALDconsult15-Sep-11 18:10
mvePIEBALDconsult15-Sep-11 18:10 
QuestionShould we get rid of the redundant quotes now that HTML5 does it? Pin
ed welch12-Sep-11 11:20
ed welch12-Sep-11 11:20 
Questioni have question about rss xml. Pin
buffering837-Aug-11 16:41
buffering837-Aug-11 16:41 
AnswerRe: i have question about rss xml. Pin
Dr.Walt Fair, PE7-Aug-11 17:31
professionalDr.Walt Fair, PE7-Aug-11 17:31 
QuestionXSD question - Calling an xsd from another xsd Pin
bgallagher_lib4-Aug-11 5:06
bgallagher_lib4-Aug-11 5:06 
AnswerRe: XSD question - Calling an xsd from another xsd Pin
Ger Hayden5-Aug-11 23:24
Ger Hayden5-Aug-11 23:24 
Questiondisplat html via xslt macro Pin
benams26-Jul-11 3:31
benams26-Jul-11 3:31 
QuestionHow to Work with XML file in MFC Dialog based application? Pin
Le@rner25-Jul-11 20:29
Le@rner25-Jul-11 20:29 
AnswerRe: How to Work with XML file in MFC Dialog based application? - Repost Pin
Richard MacCutchan25-Jul-11 21:30
mveRichard MacCutchan25-Jul-11 21:30 
QuestionShould I ask for better XML? Pin
chriselst18-Jul-11 0:02
chriselst18-Jul-11 0:02 
AnswerRe: Should I ask for better XML? Pin
dasblinkenlight18-Jul-11 3:10
dasblinkenlight18-Jul-11 3:10 
GeneralRe: Should I ask for better XML? Pin
chriselst18-Jul-11 3:23
chriselst18-Jul-11 3:23 
GeneralRe: Should I ask for better XML? Pin
dasblinkenlight18-Jul-11 3:38
dasblinkenlight18-Jul-11 3:38 
GeneralRe: Should I ask for better XML? Pin
jschell25-Jul-11 10:58
jschell25-Jul-11 10:58 
GeneralRe: Should I ask for better XML? Pin
dasblinkenlight25-Jul-11 19:08
dasblinkenlight25-Jul-11 19:08 
GeneralRe: Should I ask for better XML? Pin
jschell26-Jul-11 9:38
jschell26-Jul-11 9:38 
GeneralRe: Should I ask for better XML? Pin
dasblinkenlight26-Jul-11 10:37
dasblinkenlight26-Jul-11 10:37 
GeneralRe: Should I ask for better XML? Pin
jschell27-Jul-11 12:04
jschell27-Jul-11 12:04 
AnswerRe: Should I ask for better XML? Pin
jschell25-Jul-11 11:00
jschell25-Jul-11 11:00 
QuestionCan anybody tell me whats wrong with this xslt Pin
Haim Nachum26-Jun-11 13:00
Haim Nachum26-Jun-11 13:00 
AnswerRe: Can anybody tell me whats wrong with this xslt Pin
Nagaraj Muthuchamy26-Jun-11 23:33
professionalNagaraj Muthuchamy26-Jun-11 23:33 
QuestionLoop over chars in a string Pin
KenBonny1-Jun-11 1:58
KenBonny1-Jun-11 1:58 
AnswerRe: Loop over chars in a string [modified] Pin
George L. Jackson7-Jun-11 10:27
George L. Jackson7-Jun-11 10:27 
QuestionGetting XML content Pin
stevenykl31-May-11 19:43
stevenykl31-May-11 19:43 
Hello mates,

I am new to XSL and would like to transform a NewML G2 format XML into another XML.

For example I have:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 
- Structure: NML2 SNI Text 
-->
<!-- ========================================================= -->
<newsMessage xmlns="http://iptc.org/std/nar/2006-10-01/" xmlns:rtr="http://www.reuters.com/ns/2003/08/content" xmlns:x="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <transmitId>tag:123.com,0000:newsml_N19279043:609406403</transmitId>
    <priority>3</priority>
    <destination>ABX</destination>
  </header>
  <itemSet>
    <newsItem conformance="power" guid="tag:reuters.com,0000:newsml_N19279043" standard="NewsML-G2" standardversion="2.1" version="609406403" xml:lang="en">
      <itemMeta>
        <itemClass qcode="icls:text" rtr:msgType="S"/>
        <provider literal="reuters.com"/>
        <versionCreated>2011-05-20T05:00:27.000Z</versionCreated>
      </itemMeta>
      <contentMeta>
        <urgency>3</urgency>
        <infoSource literal="Reuters" role="cRole:origProv"/>
        <subject qcode="N2:BNK"/>
        <headline>My Headline</headline>
        <by>ABC</by>
      </contentMeta>
      <contentSet>
        <inlineXML contenttype="application/xhtml+html" wordcount="881">
          <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
              <title/>
            </head>
            <body>
              <p>Paragraph A</p>
              <p>* Paragraph A</p>
            </body>
          </html>
        </inlineXML>
      </contentSet>
    </newsItem>
  </itemSet>
</newsMessage>


I would like my result XML to be something like:

<?xml version="1.0" encoding="UTF-8"?>
<MyData>
        <MyTransmitId>tag:123.com,0000:newsml_N19279043:609406403</MyTransmitId>
        <MyHeadline>My Headline</MyHeadline>
        <MyContent>
          <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
              <title/>
            </head>
            <body>
              <p>Paragraph A</p>
              <p>* Paragraph A</p>
            </body>
          </html>
        </MyContent>
</MyData>



I come out with the following XSL:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt">
	<xsl:output method="xml" indent="yes" encoding="utf-8" />
	<xsl:template match="/newsMessage">
    <MyTransmitId>
      <xsl:value-of select="header/transmitId"/>
		</MyTransmitId>
    <MyHeadline>
      <xsl:value-of select="itemSet/newsItem/contentMeta/headline"/>
    </MyHeadline>
    <MyContent>
      <xsl:value-of select="itemSet/newsItem/contentSet/inlineXML"/>
    </MyContent>
  </xsl:template>
</xsl:stylesheet>


However it transforms to something not quite right.

What is wrong with my XSL?

Thank you very much.
AnswerRe: Getting XML content Pin
Erik Molenaar31-May-11 22:30
Erik Molenaar31-May-11 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.