Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Creating an .XSL file (http://www.velocityreviews.com/forums/t600410-creating-an-xsl-file.html)

Stu 03-20-2008 03:00 PM

Creating an .XSL file
 
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>

Martin Honnen 03-20-2008 03:06 PM

Re: Creating an .XSL file
 
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
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 Honnen
http://JavaScript.FAQTs.com/

Stu 03-20-2008 06:30 PM

Re: Creating an .XSL file
 
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
> * *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 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


TOUDIdel 03-21-2008 09:18 AM

Re: Creating an .XSL file
 

Uzytkownik "Stu" <beefstu350@hotmail.com> napisal w wiadomosci
news:1d092899-3c07-45e3-a588-8b0baf41964f@s50g2000hsb.googlegroups.com...
> 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>


--
td




All times are GMT. The time now is 09:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.