Site icon Hip-Hop Website Design and Development

How do I display only the relevant attributes?

I use code like this to display product attributes:

<?php if('pa_edition' == $attribute_name): ?>
                    <div class="summary-body-section">
                        <ul class="product-type-selector">
                            <?php 
                            $terms = get_terms("pa_edition");
                            $count = '';
                            foreach ( $terms as $term ) {
                                $count++;
                                echo "<li class='change_edition scroll-to-item' data-title='". $term->name ."' data-value='". $term->slug ."'><a href='#product-image-0". $count ."'>". $term->name ."</a></li>";
                            }
                            ?>
                        </ul><!-- end product-colors-selector -->
                    </div><!-- end summary-body-section -->
                <?php endif; ?>

And it works well. But the problem is that all existing attributes are displayed, even those that are not assigned to the product. I could not solve this issue. Could any one help me please.