User Tools

Site Tools


xslt

Header

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

</xsl>                

Change atribute value

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>
<xsl:template match="@type[parent::property]">
  <xsl:attribute name="type">
    <xsl:value-of select="'your value here'"/>
  </xsl:attribute>
</xsl:template>
<xsl:template match="@type[parent::xhtml:property]">
  <xsl:attribute name="type">
        <xsl:text>some new value</xsl:text> 
  </xsl:attribute>
</xsl:template>

xslt php transformation

<?php

// import XML
$xml = new DomDocument();
$xml->load("rss.xml");

// import XSLT
$xsl = new DomDocument();
$xsl->load("rss2html.xsl");

// create XSLT
$proc = new xsltprocessor();
$proc->importStylesheet($xsl);

// finishing
echo $proc->transformToXML($xml);
?>
xslt.txt · Last modified: 2017/11/08 13:52 by Jan Forman