I've learned quite a lot since my last post. I've managed to rework my
XSL file in accordance with Mike Kay's suggestions. I only have one
obstacle left in my transformation.
Here is the beginning of my input XML:
<?xml version="1.0" encoding="utf-16"?>
<sequence version="1" description="Deploy Server"
command="DeployServer.xml"
xmlns="http://schemas.microsoft.com/ads/2003/sequence">
<task description="Launch Image Deployment Tool" doesReboot="false">
<command target="controller">C:\Patches\Tools\dpIDT.vbs</command>
<parameters>
<parameter>$device.system.name$</parameter>
<parameter>_osName_</parameter>
</parameters>
</task>
And here is part of the relevant XSL:
xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ads="http://schemas.microsoft.com/ads/2003/sequence"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="osName" select="'WIN2K3'"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ads:parameter[.='_osName_']">
<xsl:element name="parameter"><xsl:value-of
select="$osName"/></xsl:element>
</xsl:template>
Now the match works just fine, the issue is the element parameter looks
like this in the output:
<task description="Launch Image Deployment Tool" doesReboot="false">
<command target="controller">C:\Patches\Tools\dpIDT.vbs</command>
<parameters>
<parameter>$device.system.name$</parameter>
<parameter xmlns="">WIN2K3</parameter>
</parameters>
</task>
My interpreter does not like the empty namespace declaration. The only
way I have figured out how to get it to not show is by using this as a
template instead:
<xsl:template match="ads:parameter[.='_osName_']">
<xsl:text disable-output-escaping="yes"><parameter></xsl:text>
<xsl:value-of select="$osName"/>
<xsl:text
disable-output-escaping="yes"></parameter></xsl:text>
</xsl:template>
And that's REAL UGLY!
Is there a better? A real way, using XSLT logic?