Creating an .XSL file

S

Stu

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>
 
M

Martin Honnen

Stu said:
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
xmlns:xsl="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>
 
S

Stu

Stu said:
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
   xmlns:xsl="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,

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
 
T

TOUDIdel

Uzytkownik "Stu said:
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
xmlns:xsl="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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top