Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Creating an .XSL file

Reply
Thread Tools

Creating an .XSL file

 
 
Stu
Guest
Posts: n/a
 
      03-20-2008
can sombody point me in the right direction.

I have an XML file (see below) and I am looking to create an .xsl file
that will
replace this line <actual_volume>{VAR}</actual_volume> with this
line <actual_volume>e:/tmp/xyz</actual_volume>

Thanks to all who answer this post

<axsone_dbmap version="1.0">
<dbmap_entries>
<dbmap_entry>
<logical_library>LOG</logical_library>
<actual_library>logs</actual_library>
<actual_volume>{ABC}</actual_volume>
</dbmap_entry>
<dbmap_entry>
<logical_library>CONFIG</logical_library>
<actual_library>config</actual_library>
<actual_volume>${CTRONHOME}</actual_volume>
</dbmap_entry>
<dbmap_entry>
<logical_library>DATA</logical_library>
<actual_library>data</actual_library>
<actual_volume>{VAR}</actual_volume>
</dbmap_entry>
</dbmap_entries>
</axsone_dbmap>
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-20-2008
Stu wrote:

> I have an XML file (see below) and I am looking to create an .xsl file
> that will
> replace this line <actual_volume>{VAR}</actual_volume> with this
> line <actual_volume>e:/tmp/xyz</actual_volume>


Start with the identity transformation, then add a template for that
element:

<xsl:stylesheet
xmlnssl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="actual_volume[. = '{VAR}']">
<xsl:copy>
<xsl:text>e:/tmp/xyz</xsl:text>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Stu
Guest
Posts: n/a
 
      03-20-2008
On Mar 20, 11:06*am, Martin Honnen <mahotr...@yahoo.de> wrote:
> Stu wrote:
> > I have an XML file (see below) and I am looking to create an .xsl file
> > that will
> > replace this line <actual_volume>{VAR}</actual_volume> with this
> > line <actual_volume>e:/tmp/xyz</actual_volume>

>
> Start with the identity transformation, then add a template for that
> element:
>
> <xsl:stylesheet
> * *xmlnssl="http://www.w3.org/1999/XSL/Transform"
> * *version="1.0">
>
> * *<xsl:template match="@* | node()">
> * * *<xsl:copy>
> * * * *<xsl:apply-templates select="@* | node()"/>
> * * *</xsl:copy>
> * *</xsl:template>
>
> * *<xsl:template match="actual_volume[. = '{VAR}']">
> * * *<xsl:copy>
> * * * *<xsl:text>e:/tmp/xyz</xsl:text>
> * * *</xsl:copy>
> * *</xsl:template>
> </xsl:stylesheet>
>
> --
>
> * * * * Martin Honnen
> * * * *http://JavaScript.FAQTs.com/


Martin,

Thanks for your response but I failed to be specific and I apologize
for that.

I ONLY want to to change the line <actual_volume>{VAR}</
actual_volume> WHERE <logical_library>DATA</logical_library> in my
example, which I failed to show earlier I could have multiple lines
of <actual_volume>{VAR}</actual_volume>. Your solution changes
eveything.

Thanks in advance for your help

 
Reply With Quote
 
TOUDIdel
Guest
Posts: n/a
 
      03-21-2008

Uzytkownik "Stu" <> napisal w wiadomosci
news:1d092899-3c07-45e3-a588-...
> I ONLY want to to change the line <actual_volume>{VAR}</
>actual_volume> WHERE <logical_library>DATA</logical_library> in my
>example, which I failed to show earlier I could have multiple lines
>of <actual_volume>{VAR}</actual_volume>. Your solution changes
>eveything.



<xsl:stylesheet
xmlnssl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="actual_volume[. = '{VAR}' and
.../logical_library/text() = 'DATA']">
<xsl:copy>
<xsl:text>e:/tmp/xyz</xsl:text>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


--
td


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a File object out of the contents of jar/zip file kotauk@gmail.com Java 5 04-06-2006 08:36 PM
"Error Creating Control" when creating a custom control (Design Time). Can't see tooltip message. Ravi Ambros Wallau ASP .Net Web Controls 0 06-01-2005 02:36 PM
"Error Creating Control" when creating a custom control (Design Time). Can't see tooltip message. Ravi Ambros Wallau ASP .Net 0 06-01-2005 02:36 PM
Any way to rename a current File without creating a new File object? C-man Java 9 04-11-2004 04:21 AM
What is better /standard for creating files. a cpp file with header or cpp and seperate file for header DrUg13 C++ 1 02-10-2004 09:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57