$xml .= '<slides>';
query_posts( 'cat=' . $portfolio_id . '&posts_per_page=' . $num_posts . '' );
if( have_posts() ) : while( have_posts() ) : the_post();
preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $post->post_content, $m );
$xml .= '<slide>';
if( $m[ 1 ] ) $xml .= '<url>' . $m[ 1 ][ 0 ] . '</url>';
$xml .= '<description>';
$xml .= '<link target="_self">' . $post->guid . '</link>';
$xml .= '<heading>' . $post->post_title . '</heading>';
$xml .= '<paragraph>' . $post->post_excerpt . '</paragraph>';
$xml .= '</description>';
$xml .= '</slide>';
$xml .= '<transition num="' . rand(2, 5) . '" slicing="' . $slice_value[$rand_slice_keys[rand(0, 1)]] . '" direction="' . $direction_value[$rand_direction_keys[rand(0, 3)]] . '" shader="phong" delay="0.05" z_multiplier="4" />';
endwhile; endif;
$xml .= '</slides>';