Register
It is currently Sun Apr 22, 2018 9:40 pm

xsltproc


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Fri May 06, 2016 6:03 am   

Joined: Tue Nov 17, 2015 6:30 am
Posts: 70
Hi

I'm attempting a transform on the command line, but keep getting "version=" prepended to my output csv file.
When I attempt similar using my browser or Notepadd++ plugin I don't see the prepended text
Could any of you suggest why?
command
Code:
xsltproc -o csv.txt images.xsl images.xml

xslt
Code:
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">
<xsl:for-each select="all">
   <xsl:apply-templates select="./img" />
</xsl:for-each>
</xsl:template>

<xsl:template match="img">
  <xsl:value-of select="@name" />
  <xsl:text>, </xsl:text>
  <xsl:value-of select="title/@text" />
  <xsl:text>&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

sample xml
Code:
<?xml-stylesheet href="images.xsl" type="text"?>
<all>
<img name="be">
   <title text="Our Lady's Church, Brugge, Belgium" />image of stained glass in a church
</img>
<img name="mq">
   <title text="The Euro" />Euro image
</img>
<img name="bkstack">
   <title text="Open Source Library" />Open Source library
</img>
<img name="wp">
   <title text="The sky's the limit" />Sky Image
</img>
</all>
output
Code:
[[email protected] xml_xslt]$ head csv.txt
<?xml version="1.0"?>
be, Our Lady's Church, Brugge, Belgium
mq, The Euro
bkstack, Open Source Library
wp, The sky's the limit
lib, Reference books
..
..


Top
 Profile  
 PostPosted: Fri May 06, 2016 8:50 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
This tag is part of definition of XML docs.
So the browsers do know about version but do not display it.


Top
 Profile  
 PostPosted: Fri May 06, 2016 10:02 am   

Joined: Tue Nov 17, 2015 6:30 am
Posts: 70
thanks, so I guess using tail -n +2 is the only way to avoid first line then! was trying to avoid that.


Top
 Profile  
 PostPosted: Wed May 11, 2016 10:00 am   

Joined: Tue Nov 17, 2015 6:30 am
Posts: 70
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:output omit-xml-declaration="yes"/>

finally found solution!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP