note 83399 added to ref.xslt
| From: | Jeroen at osu1 dot php dot net | Date: | Fri, 23 May 2008 18:51:11 +0000 |
| Subject: | note 83399 added to ref.xslt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139653@lists.php.net to get a copy of this message | ||
In addition to the contibution of "tom at kornack dot com" about converting an Apple plist
(iPhoto or iTunes library or other) into a more general XML format, I have tried to simplify his xsl
file a little further:
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="no"/>
<!-- XSL file based on example on php.net by tom@kornack.com -->
<xsl:template match="dict">
<xsl:for-each select="key">
<xsl:variable name="n1" select="translate(.,'
','_')"/>
<xsl:variable name="pName"><xsl:choose>
<xsl:when test="string(number($n1))='NaN'">
<xsl:value-of select="$n1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('_',$n1,'_')"/>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:element name="{$pName}">
<xsl:apply-templates select="following-sibling::*[1]"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="array">
<xsl:for-each select="*"><xsl:element name="item">
<xsl:attribute name="nr"><xsl:number/></xsl:attribute>
<xsl:apply-templates select="."/>
</xsl:element></xsl:for-each>
</xsl:template>
<xsl:template match="string|integer|real|date|data">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="true|false">
<xsl:value-of select="name()"/>
</xsl:template>
<xsl:template match="text()|@*">
</xsl:template>
</xsl:transform>
----
Server IP: 66.207.199.35
Probable Submitter: 89.220.213.116
----
Manual Page -- http://www.php.net/manual/en/ref.xslt.php
Edit -- https://master.php.net/note/edit/83399
Del: integrated -- https://master.php.net/note/delete/83399/integrated
Del: useless -- https://master.php.net/note/delete/83399/useless
Del: bad code -- https://master.php.net/note/delete/83399/bad+code
Del: spam -- https://master.php.net/note/delete/83399/spam
Del: non-english -- https://master.php.net/note/delete/83399/non-english
Del: in docs -- https://master.php.net/note/delete/83399/in+docs
Del: other reasons-- https://master.php.net/note/delete/83399
Reject -- https://master.php.net/note/reject/83399
Search -- https://master.php.net/manage/user-notes.php