Hi there,
I am a xslt newbie and I am working on a stylesheet to transform the following XML. Can someone please help me in getting such a stylesheet that outputs all the departments names with HP Inkjet printers?
Thanks a lot.
SOURCE XML:
<?xml version="1.0" encoding="UTF-8"?>
Help Desk
HP
Laser
QA
HP
InkJet
Finance
HP
InkJet
HR
HP
Laser
IT
HP
InkJet
Want to get the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<MESSAGE_BODY>
</MESSAGE_BODY>
The two key things that I
Hi Rafael,
the following stylesheet does the selection and the indexing.
Regards,
Juliane.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet xmlns:xsl=“XSLT Namespace”
version=“1.0”>
<xsl:output method=“xml”/>
<xsl:template match=“/”>
<MESSAGE_BODY>
<xsl:apply-templates select=“departments/dept[.//resource[printer and type = ‘InkJet’]]”/>
</MESSAGE_BODY>
</xsl:template>
<xsl:template match=“dept”>
<xsl:attribute name=“index”>
<xsl:number value=“position() - 1”/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Thanks a lot Juliane!!!
Your help was very usefull, it worked great!!
Rafael