xsl-list
[Top] [All Lists]

Re: Problems copying elements recursively.

2003-02-07 09:28:55
On a tip from Mike Brown, I imported Evan Lenz's
stylesheet and was able to output the raw xml.
However, the data was not indented like i expected.
Can anyone help with this?

Here's the xml:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<?xml-stylesheet type="text/xsl" href="testdoc.xsl"?> 
<SomeOutput>
  <Content>
    <Code>2</Code> 
    <ID>6</ID> 
    <TranNum>1</TranNum> 
    <Rqs>
      <Rq>
        <RqLine>3</RqLine> 
        <RqAcct>6</RqAcct> 
      </Rq>
      <Rq>
        <RqLine>5</RqLine> 
        <RqAcct>34</RqAcct> 
      </Rq>
    </Rqs>
  </Content>
  <OtherDetails>
  <Title>Testing</Title> 
  <Type>E</Type> 
  <Time>12.20</Time> 
  </OtherDetails>
</SomeOutput>

Here's my stylesheet:

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:import href="xml-to-string.xsl" /> 
  <xsl:output method="xml" indent="yes" /> 
- <xsl:template match="/">
- <html>
- <head>
  <title>Testing</title> 
  </head>
- <!--  Set the background color of the html page 
  --> 
- <body bgcolor="#B0C4DE">
  <h1>Testing</h1> 
  <hr /> 
  <h3>The Raw XML for the Content node</h3> 
  <xsl:apply-templates select="//Content" /> 
  </body>
  </html>
  </xsl:template>
- <xsl:template match="Content">
- <pre style="color: blue; font-weight: bold;">
  <xsl:call-template name="xml-to-string" /> 
  </pre>
  </xsl:template>
  </xsl:stylesheet>

The imported stylesheet can be found
at:http://www.xmlportfolio.com/xml-to-string/

Imrran

Simulating the serialization of a node-set to a
string in XML syntax is an
arduous process best suited for an extension
function, but you'll probably
find Evan Lenz's stylesheet at
http://www.xmlportfolio.com/xml-to-string/
helpful.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list